function _content($params) { $itemFactory = new Docman_ItemFactory($params['group_id']); $itemTree =& $itemFactory->getItemSubTree($params['item'], $params['user']); $displayItemTreeVisitor = new Docman_View_ItemTreeUlVisitor($this, array('theme_path' => $params['theme_path'], 'docman_icons' => $this->_getDocmanIcons($params), 'default_url' => $params['default_url'], 'show_options' => $this->_controller->request->exist('show_options') ? $this->_controller->request->get('show_options') : false, 'pv' => isset($params['pv']) ? $params['pv'] : false, 'report' => isset($params['report']) ? $params['report'] : false, 'item' => $params['item'])); $itemTree->accept($displayItemTreeVisitor); $this->javascript .= $displayItemTreeVisitor->getJavascript(); echo $displayItemTreeVisitor->toHtml(); }
function display($params) { $result = array(); $itemFactory = new Docman_ItemFactory($params['group_id']); $itemTree =& $itemFactory->getItemSubTree($params['item'], $params['user']); $items = $itemTree->getAllItems(); $nb = $items->size(); if ($nb) { $it =& $items->iterator(); while ($it->valid()) { $o =& $it->current(); $result[] = $o->toRow(); $it->next(); } } return $result; }
function _content($params) { $html = ''; $itemFactory = new Docman_ItemFactory($params['group_id']); $itemTree =& $itemFactory->getItemSubTree($params['item'], $params['user']); $items = $itemTree->getAllItems(); $nb = $items->size(); if ($nb) { $html .= '<table border="0" cellpadding="0" cellspacing="4" width="100%">'; $folders = array(); $documents = array(); $it = $items->iterator(); while ($it->valid()) { $o = $it->current(); $this->is_folder = false; $o->accept($this); if ($this->is_folder) { $folders[] = $o; } else { $documents[] = $o; } $it->next(); } $nb_of_columns = 4; $width = floor(100 / $nb_of_columns); $sort = create_function('&$a, &$b', 'return strnatcasecmp($a->getTitle(), $b->getTitle());'); usort($folders, $sort); usort($documents, $sort); $cells = array_merge($folders, $documents); $rows = array_chunk($cells, $nb_of_columns); $item_parameters = array('icon_width' => '32', 'theme_path' => $params['theme_path'], 'get_action_on_icon' => new Docman_View_GetActionOnIconVisitor(), 'docman_icons' => $this->_getDocmanIcons($params), 'default_url' => $params['default_url'], 'show_options' => $this->_controller->request->exist('show_options') ? $this->_controller->request->get('show_options') : false, 'item' => $params['item']); foreach ($rows as $row) { $html .= '<tr style="vertical-align:top">'; foreach ($row as $cell => $nop) { $html .= '<td width="' . $width . '%">' . $this->_displayItem($row[$cell], $item_parameters) . '</td>'; } $html .= '<td width="' . $width . '%"> </td>'; $html .= '</tr>'; } $html .= '</table>' . "\n"; } echo $html; }
public function getTree(DOMDocument $doc) { // Get root item $itemFactory = new Docman_ItemFactory($this->groupId); $user = UserManager::instance()->getCurrentUser(); $rootItem = $itemFactory->getRoot($this->groupId); $tree = $itemFactory->getItemSubTree($rootItem, $user, true, true); $xmlExport = new Docman_XMLExportVisitor($doc); $xmlExport->setDataPath($this->dataPath); return $xmlExport->getXML($tree); }