PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/content/code/trunk/modules/mod_artofcontent_docman/mod_artofcontent_docman.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 79 lines | 47 code | 15 blank | 17 comment | 12 complexity | a36beb539b7ab5db962fea69618f2f81 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id:combolayout.php 2547 2007-11-10 04:37:15Z masterchief $
  4. * @package NewLifeInIT
  5. * @subpackage mod_artofcontent_docman
  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. * @author Andrew Eddie <andrew.eddie@newlifeinit.com>
  9. * @link http://www.theartofjoomla.com/extensions/artof-content.html
  10. */
  11. // No direct access.
  12. defined('JPATH_BASE') or die();
  13. $option = JRequest::getCmd('option');
  14. $view = JRequest::getCmd('view');
  15. if ($option != 'com_content' && $view != 'category' && $view != 'article') {
  16. return false;
  17. }
  18. // Include dependancies.
  19. if (!class_exists('modArtofContentDocManHelper')) {
  20. require dirname(__FILE__).'/helper.php';
  21. }
  22. // Load the attributes in the JDOC tag into the parameters.
  23. $temp = new JParameter(null);
  24. $temp->loadArray($attribs);
  25. $params->merge($temp);
  26. try
  27. {
  28. // See if there is a DOCman category related to this category.
  29. $dCategoryId = modArtofContentDocManHelper::getCategoryId(JRequest::getInt('id'), $view);
  30. $limit = $params->get('limit', 5);
  31. $order = $params->get('order', 'name');
  32. if ($dCategoryId) {
  33. // Include dependancies.
  34. if (!file_exists(JPATH_ADMINISTRATOR.'/components/com_docman/docman.class.php')) {
  35. throw new Exception(JText::_('MOD_ARTOFCONTENT_DOCMAN_NOT_INSTALLED'));
  36. }
  37. require_once JPATH_ADMINISTRATOR.'/components/com_docman/docman.class.php';
  38. // DOCman core interaction API
  39. global $_DOCMAN;
  40. if (!is_object($_DOCMAN)) {
  41. $_DOCMAN = new dmMainFrame();
  42. $_DMUSER = $_DOCMAN->getUser();
  43. }
  44. $_DOCMAN->setType(_DM_TYPE_MODULE);
  45. // $itemId = $_DOCMAN->getMenuId();
  46. // Workaround due to bug in DOCman API *sigh*
  47. $menus = DOCMAN_Menus::getList();
  48. if (array_key_exists(0, $menus)) {
  49. $itemId = $menus[0];
  50. }
  51. else {
  52. $itemId = current($menus);
  53. }
  54. require_once $_DOCMAN->getPath('classes', 'utils');
  55. require_once $_DOCMAN->getPath('classes', 'file');
  56. require_once $_DOCMAN->getPath('classes', 'model');
  57. $items = DOCMAN_Docs::getDocsByUserAccess($dCategoryId, $order, 'ASC', $limit);
  58. require JModuleHelper::getLayoutPath($module->module, $params->get('layout', 'default'));
  59. }
  60. }
  61. catch (Exception $e)
  62. {
  63. JError::raiseWarning(500, $e->getMessage());
  64. }