PageRenderTime 56ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/redirect/code/trunk/administrator/components/com_redirect/controller.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 65 lines | 29 code | 8 blank | 28 comment | 4 complexity | c8cea85ecb5d60f1b5259d77b5a9b9f6 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: controller.php 390 2010-11-05 11:35:33Z eddieajau $
  4. * @package NewLifeInIT
  5. * @subpackage com_redirect
  6. * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
  7. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  8. * @link http://www.theartofjoomla.com
  9. */
  10. defined('_JEXEC') or die;
  11. jimport('joomla.application.component.controller');
  12. /**
  13. * Base controller class for Redirect.
  14. *
  15. * @package NewLifeInIT
  16. * @subpackage com_redirect
  17. * @since 1.0
  18. */
  19. class RedirectController extends JController
  20. {
  21. /**
  22. * Method to display a view.
  23. *
  24. * @return void
  25. * @since 1.0
  26. */
  27. public function display()
  28. {
  29. // Get the document object.
  30. $document = JFactory::getDocument();
  31. // Set the default view name and format from the Request.
  32. $vName = JRequest::getWord('view', 'links');
  33. $vFormat = $document->getType();
  34. $lName = JRequest::getWord('layout', 'default');
  35. // Get and render the view.
  36. if ($view = $this->getView($vName, $vFormat)) {
  37. switch ($vName)
  38. {
  39. default:
  40. $model = $this->getModel($vName);
  41. break;
  42. }
  43. // Push the model into the view (as default).
  44. if ($model) {
  45. $view->setModel($model, true);
  46. }
  47. // Push document object into the view.
  48. $view->document = $document;
  49. // Set the layout for the view.
  50. $view->setLayout($lName);
  51. $view->display();
  52. }
  53. else {
  54. // Error condition.
  55. }
  56. }
  57. }