PageRenderTime 42ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/contentmanager/code/trunk/administrator/components/com_contentmanager/controllers/rule.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 71 lines | 40 code | 8 blank | 23 comment | 1 complexity | 7049d2715d7bd78e4e84599aa9001d81 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: rule.php 160 2009-07-09 00:06:09Z 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. require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_control'.DS.'controllers'.DS.'rule.php');
  12. /**
  13. * @package TAOJ.ContentManager
  14. * @subpackage com_contentmanager
  15. */
  16. class ContentManagerControllerRule extends ControlControllerRule
  17. {
  18. var $_section = array('com_contentmanager', 'com_contentmanager-emails');
  19. /**
  20. * Sets the sub-menu
  21. *
  22. * @param string The name of the active view
  23. */
  24. function setSubmenu($viewName)
  25. {
  26. JSubMenuHelper::addEntry(JText::_('CONTMAN_LINK_SPLASH_PAGES'), 'index.php?option=com_contentmanager&view=splashes');
  27. JSubMenuHelper::addEntry(JText::_('CONTMAN_LINK_ACCESS_CONTROL'), 'index.php?option=com_contentmanager&task=rule.display', true);
  28. // Check for the JXtended WYSIWYG Editor plugin
  29. $db = &JFactory::getDbo();
  30. $db->setQuery(
  31. 'SELECT COUNT(id)' .
  32. ' FROM #__plugins' .
  33. ' WHERE element = '.$db->quote('wysiwyg').
  34. ' AND folder = '.$db->quote('editors').
  35. ' AND published = 1'
  36. );
  37. if ($db->loadResult()) {
  38. JSubMenuHelper::addEntry(JText::_('CONTMAN_LINK_EDITOR_TEMPLATES'), 'index.php?option=com_contentmanager&view=templates');
  39. }
  40. }
  41. /**
  42. * Ensures the category AXO's are sync'd
  43. *
  44. * @param object An ACL model
  45. */
  46. function synchronize(&$model)
  47. {
  48. $db = &JFactory::getDBO();
  49. $query = new JXQuery;
  50. // Categories
  51. $query->select('c.id');
  52. $query->select('CONCAT_WS('.$db->Quote(' / ').',s.title,c.title) AS title');
  53. $query->select('(s.ordering*1000+c.ordering) AS ordering');
  54. $query->select('c.access');
  55. $query->from('#__categories AS c');
  56. $query->join('INNER', '#__sections AS s ON s.id = c.section');
  57. $query->order('s.ordering, s.title, c.ordering, c.title');
  58. $db->setQuery($query->toString());
  59. $items = $db->loadObjectList('id');
  60. jximport2('jxtended.acl.acladmin');
  61. JxAclAdmin::synchronizeAssets($items, 'com_contentmanager');
  62. }
  63. }