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 fetchCategoryList($id) { global $_DOCMAN, $_DMUSER; $children = DOCMAN_Cats::getChildsByUserAccess($id); $items = array(); foreach ($children as $child) { $cat = new DOCMAN_Category($child->id); // process content mambots DOCMAN_Utils::processContentBots($cat, 'description'); $item = new StdClass(); $item->links =& $cat->getLinkObject(); $item->paths =& $cat->getPathObject(); $item->data =& $cat->getDataObject(); $items[] = $item; } // display the entries return HTML_DMCategories::displayCategoryList($items); }
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; }