function showListview() { global $_DOCMAN; $assets = JURI::root() . "components/com_docman/assets"; // add styles and scripts $doc =& JFactory::getDocument(); JHTML::_('behavior.mootools'); $doc->addStyleSheet($assets . '/css/doclink.css'); $doc->addScript($assets . '/js/sortabletable.js'); $doc->addScript($assets . '/js/listview.js'); if (isset($_REQUEST['catid'])) { $cid = intval($_REQUEST['catid']); } else { $cid = 0; } //get folders $cats = DOCMAN_Cats::getChildsByUserAccess($cid); //get items if ($cid) { $docs = DOCMAN_Docs::getDocsByUserAccess($cid, 'name', 'ASC', 999, 0); } else { $docs = array(); } //if ($entries_cnt) HTML_DMDoclink::createHeader(); HTML_DMDoclink::createFolders($cats, $cid); HTML_DMDoclink::createItems($docs, $cid); HTML_DMDoclink::createFooter(); }
function fetchDocumentList($catid) { global $_DOCMAN, $_DMUSER, $ordering, $direction, $limit, $limitstart; if (!$catid) { return; } $rows = DOCMAN_Docs::getDocsByUserAccess($catid, $ordering, $direction, $limit, $limitstart); if (!is_array($rows)) { $rows = array(); } $params = array('limit' => $limit, 'limitstart' => $limitstart); // create orderby object $links = array(); $links['name'] = _taskLink('cat_view', $catid, array_merge($params, array('order' => 'name', 'dir' => $direction))); $links['date'] = _taskLink('cat_view', $catid, array_merge($params, array('order' => 'date', 'dir' => $direction))); $links['hits'] = _taskLink('cat_view', $catid, array_merge($params, array('order' => 'hits', 'dir' => $direction))); if ($direction == 'ASC') { $links['dir'] = _taskLink('cat_view', $catid, array_merge($params, array('order' => $ordering, 'dir' => 'DESC'))); } else { $links['dir'] = _taskLink('cat_view', $catid, array_merge($params, array('order' => $ordering, 'dir' => 'ASC'))); } //set pathway information $pathway = new StdClass(); $pathway->links = $links; //set order information $order = new StdClass(); $order->links = $links; $order->direction = $direction; $order->orderby = $ordering; $order->limit = $limit; $order->limitstart = $limitstart; $items = array(); foreach ($rows as $row) { // onFetchDocument event, type = list $bot = new DOCMAN_mambot('onFetchDocument'); $bot->setParm('id', $row->id); $bot->copyParm('type', 'list'); $bot->trigger(); if ($bot->getError()) { _returnTo('cat_view', $bot->getErrorMsg()); } // load doc $doc =& DOCMAN_Document::getInstance($row->id); // process content mambots DOCMAN_Utils::processContentBots($doc, 'dmdescription'); $item = new StdClass(); $item->buttons =& $doc->getLinkObject(); $item->paths =& $doc->getPathObject(); $item->data =& $doc->getDataObject(); $items[] = $item; } return HTML_DMDocuments::displayDocumentList($order, $items); }
function getLinks($args) { global $_DOCMAN, $mainframe; $wf = WFEditorPlugin::getInstance(); jimport('joomla.filesystem.file'); require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'docman.class.php'; //DOCMan core interaction API $_DOCMAN = new dmMainFrame(_DM_TYPE_DOCLINK); // Load classes and language require_once $_DOCMAN->getPath('classes', 'utils'); $cid = isset($args->gid) ? $args->gid : 0; //get folders $categories = DOCMAN_Cats::getChildsByUserAccess($cid); $items = array(); $view = isset($args->view) ? $args->view : ''; switch ($view) { default: foreach ($categories as $category) { $items[] = array('id' => 'index.php?option=com_docman&view=category&gid=' . $category->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $category->name, 'class' => 'folder docmanlinks'); } break; case 'category': //get items if ($cid) { $categories = DOCMAN_Cats::getChildsByUserAccess($cid); $documents = DOCMAN_Docs::getDocsByUserAccess($cid, 'name', 'ASC', 999, 0); } else { $categories = array(); $documents = array(); } foreach ($categories as $category) { $items[] = array('id' => 'index.php?option=com_docman&view=category&gid=' . $category->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $category->name, 'class' => 'folder docmanlinks'); } foreach ($documents as $document) { $items[] = array('id' => 'index.php?option=com_docman&task=doc_' . $wf->getParam('docmanlinks_link', 'download') . '&gid=' . $document->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $document->dmname, 'class' => 'file docmanlinks ' . JFile::getExt($document->dmfilename)); } break; } return $items; }
// Oldest $order = "date"; $dir = "ASC"; break; case 4: // Alphabetically $order = "name"; $dir = "ASC"; break; case 5: // Alphabetically, reverse $order = "name"; $dir = "DESC"; break; } $rows = DOCMAN_Docs::getDocsByUserAccess($cat_limit, $order, $dir, $limits); // If we have a textual prefix, show it now if (strlen($text_pfx) > 0) { $html .= "<span class='{$class_prefix}'>" . $text_pfx . "</span><br />"; } // List output if ($show_list == 1) { $html .= "<ul>"; } // For each row of our result.. foreach ($rows as $row) { // List output if ($show_list == 1) { $html .= "<li>"; } // Create a new document
$_DOCMAN = new dmMainFrame(); $_DMUSER = $_DOCMAN->getUser(); } $_DOCMAN->setType(_DM_TYPE_MODULE); $_DOCMAN->loadLanguage('modules'); require_once $_DOCMAN->getPath('classes', 'utils'); require_once $_DOCMAN->getPath('classes', 'file'); require_once $_DOCMAN->getPath('classes', 'model'); // get the parameters $catid = $params->def('catid', ''); $limits = (int) $params->def('limits', 3); $show_icon = (int) $params->def('show_icon', 1); $show_category = (int) $params->def('show_category', 1); $menuid = $_DOCMAN->getMenuId(); $html = '<div class="mod_docman_catdown' . $params->get('moduleclass_sfx') . '">'; $rows = DOCMAN_Docs::getDocsByUserAccess($catid, '', '', $limits); if (count($rows)) { $html .= '<ul class="mod_docman_catdown' . $params->get('moduleclass_sfx') . '">'; foreach ($rows as $row) { $doc = new DOCMAN_Document($row->id); $url = JRoute::_("index.php?option=com_docman&task=cat_view&Itemid={$menuid}&gid=" . $doc->getData('catid') . "&orderby=dmdate_published&ascdesc=DESC"); $html .= '<li><a href="' . $url . '">'; if ($show_icon) { $html .= '<img src="' . $doc->getPath('icon', 1, '16x16') . '" alt="file icon" border="0" />'; } $html .= $doc->getData('dmname'); if ($show_category) { $html .= '<br />(' . $row->cat_title . ')'; } $html .= '</a></li>'; }
$_DMUSER = $_DOCMAN->getUser(); } $_DOCMAN->setType(_DM_TYPE_MODULE); $_DOCMAN->loadLanguage('modules'); $_DOCMAN->loadLanguage('frontend'); require_once $_DOCMAN->getPath('classes', 'utils'); require_once $_DOCMAN->getPath('classes', 'file'); require_once $_DOCMAN->getPath('classes', 'model'); // get the parameters $limits = abs($params->def('limits', 3)); $show_icon = abs($params->def('show_icon', 1)); $show_category = abs($params->def('show_category', 1)); $moduleclass_sfx = $params->get('moduleclass_sfx'); $menuid = $_DOCMAN->getMenuId(); $html = '<div class="mod_docman_catdown' . $moduleclass_sfx . '">'; $rows = DOCMAN_Docs::getDocsByUserAccess(0, 'date', 'desc', $limits); if (count($rows)) { $html .= '<ul class="mod_docman_latestdown">'; foreach ($rows as $row) { $doc = new DOCMAN_Document($row->id); $catid = $doc->getData('catid'); $url = JRoute::_("index.php?option=com_docman&task=cat_view&Itemid={$menuid}&gid={$catid}&orderby=dmdate_published"); $html .= '<li><a href="' . $url . '">'; if ($show_icon) { $html .= '<img border="0" src="' . $doc->getPath('icon', 1, '16x16') . '" alt="file icon" /> '; } $html .= $doc->getData('dmname'); if ($show_category) { $html .= '<br />(' . $row->cat_title . ')'; } $html .= '</a></li>';
function getCategoryTree(&$xmap, &$parent, &$params, $catid = 0, $menuid) { $db =& JFactory::getDBO(); $limits = 25; $list = array(); $query = 'select id,title from #__categories where parent_id=' . $catid . ' and section=\'com_docman\' and published=1'; $db->setQuery($query); $rows = $db->loadRowList(); // Get sub-categories list $xmap->changeLevel(1); foreach ($rows as $row) { $node = new stdclass(); $node->id = $menuid; $node->uid = $parent->uid . 'c' . $row[0]; // should be uniq on component $node->name = $row[1]; $node->browserNav = $parent->browserNav; $node->priority = $params['cat_priority']; $node->changefreq = $params['cat_changefreq']; $node->expandible = true; $node->link = 'index.php?option=com_docman&task=cat_view&gid=' . $row[0]; if ($xmap->printNode($node) !== FALSE) { xmap_com_docman::getCategoryTree($xmap, $parent, $params, $row[0], $menuid); } } $xmap->changeLevel(-1); $include_docs = @$params['include_docs']; if ($catid > 0 && $params['include_docs']) { $xmap->changeLevel(1); $rows = DOCMAN_Docs::getDocsByUserAccess($catid, '', '', $limits); // Get documents list foreach ($rows as $row) { $doc = new DOCMAN_Document($row->id); $node = new stdclass(); $node->id = $menuid; $node->uid = $parent->uid . 'd' . $row->id; // should be uniq on component $node->link = 'index.php?option=com_docman&task=' . $params['doc_task'] . '&gid=' . $row->id . '&Itemid=' . $menuid; $node->browserNav = $parent->browserNav; $node->priority = $params['doc_priority']; $node->changefreq = $params['doc_changefreq']; $node->name = $doc->getData('dmname'); $node->type = 'separator'; $node->expandible = false; $xmap->printNode($node); } $xmap->changeLevel(-1); } return true; }
if (!is_object($_DOCMAN)) { $_DOCMAN = new dmMainFrame(); $_DMUSER = $_DOCMAN->getUser(); } $_DOCMAN->setType(_DM_TYPE_MODULE); $_DOCMAN->loadLanguage('modules'); require_once $_DOCMAN->getPath('classes', 'utils'); require_once $_DOCMAN->getPath('classes', 'file'); require_once $_DOCMAN->getPath('classes', 'model'); // get the parameters $limits = abs($params->def('limits', 3)); $show_icon = abs($params->def('show_icon', 1)); $show_counter = abs($params->def('show_counter', 1)); $menuid = $_DOCMAN->getMenuId(); $html = ''; $rows = DOCMAN_Docs::getDocsByUserAccess(0, 'hits', 'DESC', $limits); if (count($rows)) { $html .= '<ul class="dm_mod_mostdown">'; foreach ($rows as $row) { $doc = new DOCMAN_Document($row->id); $url = JRoute::_("index.php?option=com_docman&task=cat_view&Itemid={$menuid}&gid={$row->catid}"); $html .= '<li><a href="' . $url . '">'; if ($show_icon) { $html .= '<img border="0" src="' . $doc->getPath('icon', 1, '16x16') . '" alt="file icon" />'; } $html .= $doc->getData('dmname'); if ($show_counter) { $html .= ' (' . $doc->getData('dmcounter') . ')'; } $html .= '</a></li>'; }