public function gatherPermissions() { // Collect data $itemFactory = new Docman_ItemFactory($this->group->getId()); $rootItem = $itemFactory->getRoot($this->group->getId()); $this->parentTitles[$rootItem->getId()] = ''; $output = array(); $this->fetchPerms(array($rootItem->getId()), $output); return $output; }
function getTable($params) { $html = ''; // Get root $itemFactory = new Docman_ItemFactory($params['group_id']); $rootItem = $itemFactory->getRoot($params['group_id']); $nbItemsFound = 0; $itemIterator =& $itemFactory->getItemList($rootItem->getId(), $nbItemsFound, array('user' => $params['user'], 'ignore_collapse' => true, 'obsolete_only' => true)); $table = html_build_list_table_top(array('Title', 'Obsolete date')); $altRowClass = 0; $itemIterator->rewind(); while ($itemIterator->valid()) { $item =& $itemIterator->current(); $type = $itemFactory->getItemTypeForItem($item); if ($type != PLUGIN_DOCMAN_ITEM_TYPE_FOLDER) { $trclass = html_get_alt_row_color($altRowClass++); $table .= "<tr class=\"" . $trclass . "\">\n"; // Name $docmanIcons =& $this->_getDocmanIcons($params); $icon_src = $docmanIcons->getIconForItem($item, $params); $icon = '<img src="' . $icon_src . '" class="docman_item_icon" />'; $table .= "<td>"; $table .= '<span style="white-space: nowrap;">'; $table .= $icon; $url = $this->buildActionUrl($params, array('action' => 'details', 'id' => $item->getId()), false, true); $table .= '<a href="' . $url . '">'; $table .= htmlentities($item->getTitle(), ENT_QUOTES, 'UTF-8'); $table .= '</a>'; $table .= '</span>'; $table .= "</td>\n"; // Obsolete date $table .= "<td>"; $table .= format_date("Y-m-j", $item->getObsolescenceDate()); $table .= "</td>\n"; $table .= "</tr>\n"; } $itemIterator->next(); } $table .= "</table>\n"; $html = $table; return $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); }
/** * Function called when a project goes from public to private so * documents monitored by non member users should be monitored no more. * * @param array $params * * @return void */ function projectIsPrivate($params) { $groupId = $params['group_id']; $private = $params['project_is_private']; if ($private) { require_once 'Docman_ItemFactory.class.php'; $docmanItemFactory = new Docman_ItemFactory(); $root = $docmanItemFactory->getRoot($groupId); if ($root) { require_once 'Docman_NotificationsManager.class.php'; $notificationsManager = new Docman_NotificationsManager($this->getProject($groupId), null, null, $this->getMailBuilder()); $dar = $notificationsManager->listAllMonitoredItems($groupId); if ($dar && !$dar->isError()) { $userManager = UserManager::instance(); $user = null; foreach ($dar as $row) { $user = $userManager->getUserById($row['user_id']); if (!$user->isMember($groupId)) { $notificationsManager->remove($row['user_id'], $row['object_id'], $row['type']); } } } } } }