/** * Expand and draw a child entry, when it is clicked on. This is using AJAX just to render this section of the tree. */ public function draw_children($parent_entry, $code) { if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) { debug_log('Entered (%%)', 33, 0, __FILE__, __LINE__, __METHOD__, $fargs); } $children = array(); foreach ($parent_entry->getChildren() as $child) { if (!$this->getEntry($child)) { $this->addEntry($child); } array_push($children, $this->getEntry($child)); } $first_child = $this->create_before_child($parent_entry, $code); $last_child = $this->create_after_child($parent_entry, $code); # If compression is on, we need to compress this output - but only if called by draw_tree_node if (function_exists('isCompress') && isCompress() && get_request('cmd', 'REQUEST') == 'draw_tree_node') { ob_start(); } echo $first_child; for ($i = 0; $i < count($children); $i++) { $first = $i == 0 && !$first_child; $last = $i == count($children) - 1 && !$last_child; if (is_object($children[$i])) { $this->draw_item($children[$i]->getDN(), $code, $first, $last); } else { echo '<br/>problem getting DN entry from ldap'; } echo "\n"; } echo $last_child; # If compression is on, we need to compress this output if (function_exists('isCompress') && isCompress() && get_request('cmd', 'REQUEST') == 'draw_tree_node') { $output = ob_get_clean(); echo gzencode($output); } }
public function display($filter = array()) { if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) { debug_log('Entered (%%)', 129, 0, __FILE__, __LINE__, __METHOD__, $fargs); } # Control what is displayed. $display = array('HEAD' => true, 'CONTROL' => true, 'TREE' => true, 'FOOT' => true); $display = array_merge($display, $filter); # HTML Header $this->pageheader_print(); # Start of body # Page Header echo '<body>'; echo "\n"; echo '<table class="page" border=0 width=100%>'; if ($display['HEAD']) { $this->head_print(); } # Control Line if ($display['CONTROL']) { echo '<tr class="control"><td colspan=3>'; echo '<div id="ajCONTROL">'; $this->control_print(); echo '</div></td></tr>'; echo "\n"; } # Left Block echo '<tr>'; if ($display['TREE']) { echo '<td class="tree" colspan=2>'; printf('<acronym title="%s"><img src="%s/plus.png" align="right" onClick="if (document.getElementById(\'ajTREE\').style.display == \'none\') { document.getElementById(\'ajTREE\').style.display = \'block\' } else { document.getElementById(\'ajTREE\').style.display = \'none\' };"/></acronym>', _('Hide/Unhide the tree'), IMGDIR); echo '<div id="ajTREE">'; $this->tree(); echo '</div>'; echo '</td>'; } echo '<td class="body" width=80%>'; echo '<div id="ajBODY">'; echo "\n"; $this->body(); echo '</div>'; echo '</td>'; echo '</tr>'; echo "\n"; # Page Footer if ($display['FOOT']) { $this->footer_print(); } # Finish HTML echo '</table>'; echo '</body>'; echo '</html>'; # compress output if (ob_get_level() && isCompress()) { $output = ob_get_contents(); ob_end_clean(); if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) { debug_log('Sending COMPRESSED output to browser[(%s),%s]', 129, 0, __FILE__, __LINE__, __METHOD__, strlen($output), $output); } print gzencode($output); } }