<?php reset($arbre); //construction automatique de l'arbre format : (num_fils, num_pere,nom,nom_unix) while (list($key2, $sons2) = each($arbre)) { print "d.add(" . $key2 . "," . $sons2 . ",'" . $project_name[$key2][0] . "','" . util_make_link("/projects/" . $project_name[$key2][1] . "/") . "');\n"; } ?> document.write(d); </script> <?php echo '</td></tr></table>'; } /*function aff_node($node, $lvl) { for ($i = 0; $i < $lvl; ++$i) { echo " "; } echo $node . "<br/>"; }*/ $tree = build_tree(); aff_tree($tree, 0); } //docman_display_documents($nested_groups,$df,$is_editor); docman_display_documents($nested_groups, $df, ''); $HTML->footer(array()); // Local Variables: // mode: php // c-file-style: "bsd" // End:
<a href="index.php?group_id=<?php echo $group_id; ?> &addgroup=1"><?php echo _('Add/Edit Document Groups'); ?> </a> </p> <?php $selected_stateid = getIntFromRequest('selected_stateid'); if (!$d_arr || count($d_arr) < 1) { print "<p><strong>" . _('This project has no visible documents') . ".</strong></p>"; } else { // get a list of used document states $states = $df->getUsedStates(); $nested_groups =& $dgf->getNested(); echo "<ul>"; foreach ($states as $state) { echo "<li><strong>" . $state["name"] . "</strong>"; docman_display_documents($nested_groups, $df, true, $state['stateid'], true); echo "</li>"; } echo "</ul>"; } docman_footer(array()); } } // Local Variables: // mode: php // c-file-style: "bsd" // End:
/** * docman_display_documents - Recursive function to show the documents inside the groups tree */ function docman_display_documents(&$nested_groups, &$document_factory, $is_editor, $stateid = 0, $from_admin = false, $parent_group = 0) { global $selected_doc_group_id; $selected_doc_group_id = getIntFromRequest('selected_doc_group_id'); if (!is_array($nested_groups["{$parent_group}"])) { return; } echo "<ul style='list-style-type: none'>"; $child_count = count($nested_groups["{$parent_group}"]); for ($i = 0; $i < $child_count; $i++) { $doc_group =& $nested_groups["{$parent_group}"][$i]; // Display group and subgroups only if it has associated documents if ($doc_group->hasDocuments($nested_groups, $document_factory, $stateid)) { // Recursive call if (($doc_group->getID() == $selected_doc_group_id || $doc_group->hasSubgroup($nested_groups, $selected_doc_group_id)) && (!$stateid || $stateid == @$selected_stateid)) { $icon = 'ofolder15.png'; } else { $icon = 'cfolder15.png'; } echo "<li>" . html_image('ic/' . $icon, "15", "13", array("border" => "0")) . " <a href='index.php?group_id=" . $doc_group->Group->getID() . "&selected_doc_group_id=" . $doc_group->getID() . "&language_id=" . @$GLOBALS['selected_language']; if ($from_admin && $stateid) { // if we're sorting by the state, pass the state as a variable echo "&selected_stateid=" . $stateid; } echo "'>" . $doc_group->getName() . "</a>"; // display link to add a document to the current group echo " <a href='" . ($from_admin ? "../" : "") . "new.php?group_id=" . $doc_group->Group->getID() . "&selected_doc_group=" . $doc_group->getID() . "'>"; echo html_image('ic/adddoc12.png', "12", "14", array("border" => "0")) . " "; echo _('[Add document here]'); echo "</a>"; if (($doc_group->getID() == $selected_doc_group_id || $doc_group->hasSubgroup($nested_groups, $selected_doc_group_id)) && (!$stateid || $stateid == @$selected_stateid)) { docman_display_documents($nested_groups, $document_factory, $is_editor, $stateid, $from_admin, $doc_group->getID()); } } // Display this group's documents if (($doc_group->hasSubgroup($nested_groups, $selected_doc_group_id) || $selected_doc_group_id == $doc_group->getID()) && (!$stateid || $stateid == $GLOBALS['selected_stateid'])) { // Retrieve all the docs from this category if ($stateid) { $document_factory->setStateID($stateid); } $document_factory->setDocGroupID($doc_group->getID()); $docs = $document_factory->getDocuments(); if (is_array($docs)) { $docs_count = count($docs); echo "<ul style='list-style-type: none'>"; for ($j = 0; $j < $docs_count; $j++) { if ($from_admin) { $link = "index.php?editdoc=1&docid=" . $docs[$j]->getID() . "&group_id=" . $docs[$j]->Group->getID(); } else { $link = $docs[$j]->isURL() ? $docs[$j]->getFileName() : "view.php/" . $docs[$j]->Group->getID() . "/" . $docs[$j]->getID() . "/" . $docs[$j]->getFileName(); } $tooltip = $docs[$j]->getFileName() . " (" . ($docs[$j]->getUpdated() ? date(_('Y-m-d H:i'), $docs[$j]->getUpdated()) : date(_('Y-m-d H:i'), $docs[$j]->getCreated())) . ") "; if ($docs[$j]->getFilesize() > 1024) { $tooltip .= floor($docs[$j]->getFilesize() / 1024) . "KB"; } else { $tooltip .= $docs[$j]->getFilesize() . "B"; } $tooltip = htmlspecialchars($tooltip); echo "<li>" . html_image('ic/docman16b.png', "20", "20", array("border" => "0")) . " " . "<a href=\"" . $link . "\" title=\"{$tooltip}\">" . $docs[$j]->getName() . "</a> - " . $tooltip . "</li>" . "(" . $docs[$j]->getFileSize() . " " . _('bytes') . ")"; //add description echo "<br /> "; echo "<i>" . $docs[$j]->getDescription() . "</i>"; } echo "</ul>"; } } } echo "</ul>\n"; }
<input style="width: 100px" type="button" value="<?php echo _('collapse all'); ?> " onclick="ctCollapseTree('myMenuID');" /> </form> <br> <div id="myMenuID"></div> <script language="JavaScript"><!-- var myMenu = [ ['<span class="JSCookTreeFolderClosed"><i><img alt="" src="' + ctThemeXPBase + 'folder1.gif" /></i></span><span class="JSCookTreeFolderOpen"><i><img alt="" src="' + ctThemeXPBase + 'folderopen1.gif" /></i></span>', '/', '#', '', '', <?php docman_recursive_display(0); ?> ] ]; ctDraw ('myMenuID', myMenu, ctThemeXP1, 'ThemeXP', 0, 1); --></script> <noscript> <?php docman_display_documents($nested_groups, $df, $is_editor); ?> </noscript> <?php } docman_footer(array()); // Local Variables: // mode: php // c-file-style: "bsd" // End: