/content/code/trunk/modules/mod_artofcontent_docman/mod_artofcontent_docman.php
PHP | 79 lines | 47 code | 15 blank | 17 comment | 12 complexity | a36beb539b7ab5db962fea69618f2f81 MD5 | raw file
- <?php
- /**
- * @version $Id:combolayout.php 2547 2007-11-10 04:37:15Z masterchief $
- * @package NewLifeInIT
- * @subpackage mod_artofcontent_docman
- * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
- * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
- * @author Andrew Eddie <andrew.eddie@newlifeinit.com>
- * @link http://www.theartofjoomla.com/extensions/artof-content.html
- */
- // No direct access.
- defined('JPATH_BASE') or die();
- $option = JRequest::getCmd('option');
- $view = JRequest::getCmd('view');
- if ($option != 'com_content' && $view != 'category' && $view != 'article') {
- return false;
- }
- // Include dependancies.
- if (!class_exists('modArtofContentDocManHelper')) {
- require dirname(__FILE__).'/helper.php';
- }
- // Load the attributes in the JDOC tag into the parameters.
- $temp = new JParameter(null);
- $temp->loadArray($attribs);
- $params->merge($temp);
- try
- {
- // See if there is a DOCman category related to this category.
- $dCategoryId = modArtofContentDocManHelper::getCategoryId(JRequest::getInt('id'), $view);
- $limit = $params->get('limit', 5);
- $order = $params->get('order', 'name');
- if ($dCategoryId) {
- // Include dependancies.
- if (!file_exists(JPATH_ADMINISTRATOR.'/components/com_docman/docman.class.php')) {
- throw new Exception(JText::_('MOD_ARTOFCONTENT_DOCMAN_NOT_INSTALLED'));
- }
- require_once JPATH_ADMINISTRATOR.'/components/com_docman/docman.class.php';
- // DOCman core interaction API
- global $_DOCMAN;
- if (!is_object($_DOCMAN)) {
- $_DOCMAN = new dmMainFrame();
- $_DMUSER = $_DOCMAN->getUser();
- }
- $_DOCMAN->setType(_DM_TYPE_MODULE);
- // $itemId = $_DOCMAN->getMenuId();
- // Workaround due to bug in DOCman API *sigh*
- $menus = DOCMAN_Menus::getList();
- if (array_key_exists(0, $menus)) {
- $itemId = $menus[0];
- }
- else {
- $itemId = current($menus);
- }
- require_once $_DOCMAN->getPath('classes', 'utils');
- require_once $_DOCMAN->getPath('classes', 'file');
- require_once $_DOCMAN->getPath('classes', 'model');
- $items = DOCMAN_Docs::getDocsByUserAccess($dCategoryId, $order, 'ASC', $limit);
- require JModuleHelper::getLayoutPath($module->module, $params->get('layout', 'default'));
- }
- }
- catch (Exception $e)
- {
- JError::raiseWarning(500, $e->getMessage());
- }