function plugin($id)
 {
     global $_DOCMAN;
     if (!$id) {
         return;
     }
     require_once $_DOCMAN->getPath('classes', 'model');
     $doc = new DOCMAN_Document($id);
     $item = new StdClass();
     $item->links =& $doc->getLinkObject();
     $item->paths =& $doc->getPathObject();
     $item->data =& $doc->getDataObject();
     return $item;
 }
Пример #2
0
function getSearchResult($gid, $itemid)
{
    global $search_mode, $ordering, $invert_search, $reverse_order, $search_where, $search_phrase, $search_catid;
    $search_mode = ($invert_search ? '-' : '') . $search_mode;
    $searchList = array(array('search_mode' => $search_mode, 'search_phrase' => $search_phrase));
    $ordering = ($reverse_order ? '-' : '') . $ordering;
    $rows = DOCMAN_Docs::search($searchList, $ordering, $search_catid, '', $search_where);
    // This acts as the search header - so they can perform search again
    if (count($rows) == 0) {
        $msg = _DML_NOKEYWORD;
    } else {
        $msg = sprintf(_DML_SEARCH . ' ' . _DML_SEARCH_MATCHES, count($rows));
    }
    $items = array();
    if (count($rows) > 0) {
        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();
            $item->data->category = $row->section;
            $items[] = $item;
        }
    }
    return $items;
}
// 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
    $doc = new DOCMAN_Document($row->id);
    // Create the appropriate type of link
    $linkText = "";
    switch ($link_type) {
        case 0:
            $linkText = "index.php?option=com_docman&task=cat_view&amp;Itemid={$menuid}&amp;gid=" . $row->catid . "&amp;orderby=dmdatecounter&ascdesc=DESC";
            break;
        case 1:
            $linkText = "index.php?option=com_docman&amp;task=search_result&amp;Itemid={$menuid}&amp;search_phrase=" . urlencode($row->dmname) . "&amp;search_mode=phrase";
            break;
        case 2:
            $linkText = "index.php?option=com_docman&amp;task=doc_details&amp;Itemid={$menuid}&amp;gid=" . $row->id;
            break;
        case 3:
            $linkText = "index.php?option=com_docman&amp;Itemid={$menuid}&amp;task=doc_download" . $itid . "&amp;gid=" . $row->id;
            break;
$_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&amp;task=cat_view&amp;Itemid={$menuid}&amp;gid=" . $doc->getData('catid') . "&amp;orderby=dmdate_published&amp;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;
}
Пример #5
0
function showDocumentView($gid)
{
    global $_DOCMAN;
    $database = JFactory::getDBO();
    $doc = new DOCMAN_Document($gid);
    $data =& $doc->getDataObject();
    //check if we need to display a license
    if ($_DOCMAN->getCfg('display_license') && ($data->dmlicense_display && $data->dmlicense_id)) {
        //fetch the license form
        $html = new StdClass();
        $html->doclicense = fetchDocumentLicenseForm($gid, 1);
        //get the license text
        $license = new mosDMLicenses($database);
        $license->load($data->dmlicense_id);
        HTML_docman::pageDocumentLicense($html, $license->license);
    } else {
        download($doc, true);
    }
}
Пример #6
0
function fetchMoveDocumentForm($uid)
{
    global $database, $_DMUSER;
    $doc = new mosDMDocument($database);
    $doc->load($uid);
    //check user permissions
    $err = $_DMUSER->canPreformTask($doc, 'Move');
    if ($err) {
        _returnTo('cat_view', $err, $doc->catid);
    }
    $doc = new DOCMAN_Document($uid);
    // category select list
    $options = array(mosHTML::makeOption('0', _DML_SELECT_CAT));
    $lists['categories'] = dmHTML::categoryList($doc->getData('catid'), "", $options);
    return HTML_DMDocuments::moveDocumentForm($lists, $doc->getLinkObject(), $doc->getPathObject(), $doc->getDataObject());
}
Пример #7
0
$_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>';
    }
    $html .= '</ul>';
} else {
    $html .= "<br />" . _DML_MOD_NODOCUMENTS;
 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&amp;task=cat_view&amp;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&amp;task=' . $params['doc_task'] . '&amp;gid=' . $row->id . '&amp;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;
 }
Пример #9
0
    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;
    }
Пример #10
0
function fetchDocumentLicenseForm($uid, $inline = 0)
{
    $doc = new DOCMAN_Document($uid);
    return HTML_DMDownload::licenseDocumentForm($doc->getLinkObject(), $doc->getPathObject(), $doc->getDataObject(), $inline);
}
Пример #11
0
$_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>';
    }
    $html .= '</ul>';
} else {
    $html .= "<br />" . _DML_MOD_NODOCUMENTS;
}