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>'; } $html .= '</ul>'; } else { $html .= '<br />' . _DML_MOD_NODOCUMENTS; } $html .= '</div>'; echo $html;
break; case 1: $linkText = "index.php?option=com_docman&task=search_result&Itemid={$menuid}&search_phrase=" . urlencode($row->dmname) . "&search_mode=phrase"; break; case 2: $linkText = "index.php?option=com_docman&task=doc_details&Itemid={$menuid}&gid=" . $row->id; break; case 3: $linkText = "index.php?option=com_docman&Itemid={$menuid}&task=doc_download" . $itid . "&gid=" . $row->id; break; } $url = JRoute::_($linkText); $html .= "<a class=\"{$class_link}\" href=\"{$url}\">"; // If we are showing the icon, do it if ($show_icon) { $html .= "<img border='0' src=\"" . $doc->getPath('icon', 1, '16x16') . "\" alt=\"" . _DML_FILEICON_ALT . "\" /> "; } // Output the document name $html .= $doc->getData('dmname'); // If we are showing the counter or the category, do it if ($show_counter) { $html .= " (" . $doc->getData('dmcounter') . ")"; } if ($show_category) { $html .= "<br />(" . $row->cat_title . ")"; } // Add the end link and break $html .= "</a>"; // List output if ($show_list == 1) { $html .= "</li>";
function createItems($rows) { global $_DOCMAN, $mosConfig_live_site; $html = ''; foreach ($rows as $row) { $doc = new DOCMAN_Document($row->id); $links = $doc->getLinkObject(); $paths = $doc->getPathObject(); $details = $doc->getDataObject(); $icon = $doc->getPath('icon', 1, '16x16'); $url = DOCMAN_Utils::_rawLink('doc_download', $details->id); if ($details->dmlastupdateon != "0000-00-00 00:00:00") { $itemtime = $details->dmlastupdateon; } else { $itemtime = $details->dmdate_published; } ?> <tr> <td><img src="<?php echo $icon; ?> " alt="<?php echo $details->dmname; ?> " /></td> <td><a href="javascript:;" onClick="onclickItem('<?php echo addslashes($details->dmname); ?> ', '<?php echo $url; ?> ', <?php echo $details->catid; ?> , '<?php echo $icon; ?> ', '<?php echo $details->filesize; ?> ', '<?php echo $itemtime; ?> ');"><?php echo $details->dmname; ?> </td> <td><?php echo $details->filesize; ?> </td> <td><?php echo $itemtime; ?> </td> </tr> <?php } return $html; }