PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/contentmanager/code/trunk/administrator/components/com_contentmanager/controller.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 80 lines | 43 code | 10 blank | 27 comment | 5 complexity | 06ab53fb4b69423fb1f4567101e00fb5 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: controller.php 79 2009-05-31 08:20:59Z eddieajau $
  4. * @copyright Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
  5. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  6. * @link http://www.theartofjoomla.com
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. jimport('joomla.application.component.controller');
  11. /**
  12. * Component Controller
  13. *
  14. * @package TAOJ.ContentManager
  15. * @subpackage com_contentmanager
  16. */
  17. class ContentManagerController extends JController
  18. {
  19. /**
  20. * Display the view
  21. */
  22. function display()
  23. {
  24. // Get the document object.
  25. $document = &JFactory::getDocument();
  26. // Set the default view name and format from the Request.
  27. $vName = JRequest::getWord('view', 'splashes');
  28. $vFormat = $document->getType();
  29. $lName = JRequest::getWord('layout', 'default');
  30. // Get and render the view.
  31. if ($view = &$this->getView($vName, $vFormat))
  32. {
  33. switch ($vName)
  34. {
  35. default:
  36. $model = &$this->getModel($vName);
  37. break;
  38. }
  39. // Push the model into the view (as default).
  40. $view->setModel($model, true);
  41. $view->setLayout($lName);
  42. // Push document object into the view.
  43. $view->assignRef('document', $document);
  44. $this->_setupLinkbar($vName);
  45. $view->display();
  46. }
  47. }
  48. /**
  49. * Configure the Linkbar
  50. *
  51. * @param string The name of the active view
  52. */
  53. protected function _setupLinkbar($vName)
  54. {
  55. JSubMenuHelper::addEntry(JText::_('ContMan_Link_Splash_Pages'), 'index.php?option=com_contentmanager&view=splashes', $vName == 'splashes');
  56. JSubMenuHelper::addEntry(JText::_('ContMan_Link_Access_Control'), 'index.php?option=com_contentmanager&task=rule.display');
  57. // Check for the JXtended WYSIWYG Editor plugin
  58. $db = &JFactory::getDbo();
  59. $db->setQuery(
  60. 'SELECT COUNT(id)' .
  61. ' FROM #__plugins' .
  62. ' WHERE element = '.$db->quote('wysiwyg').
  63. ' AND folder = '.$db->quote('editors').
  64. ' AND published = 1'
  65. );
  66. if ($db->loadResult()) {
  67. JSubMenuHelper::addEntry(JText::_('ContMan_Link_Editor_Templates'), 'index.php?option=com_contentmanager&view=templates', $vName == 'templates');
  68. }
  69. }
  70. }