Exemple #1
0
 /**
  * A method to return the HTML code needed to display a tree-based
  * menu of all the simulations.
  *
  * @return string A string containing the HTML code needed to display
  *                the tests in a tree-based menu.
  */
 function buildTree()
 {
     $icon_pkg = "package.png";
     // Create the root of the test suite
     $menu = new HTML_TreeMenu();
     $rootNode = new HTML_TreeNode(array('text' => 'Test Datasets', 'icon' => $icon_pkg, 'link' => 'home.php', 'linkTarget' => 'right'));
     // Create the top-level test groups
     $aTypes = array('datasets' => 'menu.php');
     foreach ($aTypes as $type => $link) {
         $nodeName = $type . 'RootNode';
         ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type), 'icon' => $icon_pkg, 'link' => $link, 'linkTarget' => "left"));
         $list = get_file_list(TD_DATAPATH, '.xml', true);
         foreach ($list as $index => $file) {
             ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $file, 'icon' => $icon_pkg, 'link' => "action.php?&datasetfile={$file}", 'linkTarget' => 'right')));
         }
         $rootNode->addItem(${$nodeName});
     }
     $menu->addItem($rootNode);
     $tree = new HTML_TreeMenu_DHTML($menu);
     $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css');
     $code .= "\n<script>\n";
     $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js');
     $code .= "\n</script>";
     $code .= $tree->toHTML();
     return $code;
 }
function recurseDir($path, &$node)
{
    global $pd;
    if (!($dir = opendir($path))) {
        return false;
    }
    $anode = new HTML_TreeNode(array('text' => basename($path), 'link' => "javascript:setHelpVal('" . $path . "');", 'icon' => 'folder.gif'));
    $result = addslashes(realpath(stripslashes($path) . $pd . ".."));
    if (!$node) {
        $anode->addItem(new DirNode('..', "javascript:setHelp('" . $result . "');", 'folder.gif'), '..');
    }
    while (($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (is_dir("{$path}{$pd}{$file}")) {
                recurseDir("{$path}{$pd}{$file}", $anode);
            }
        }
    }
    rewinddir($dir);
    //
    while (false) {
        //($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (is_file("{$path}{$pd}{$file}")) {
                $anode->addItem(new DirNode($file, "javascript:setHelpVal('{$path}{$pd}{$file}');", 'branchtop.gif', "{$path}{$pd}{$file}"));
            }
        }
    }
    if (!$node) {
        $node = $anode;
    } else {
        $node->addItem($anode);
    }
    closedir($dir);
}
 private function crearNodos($array)
 {
     list($nivel, $presedencia, $codigo, $deriva, $descripcion, $url, $array1) = $array;
     $icon = $this->arrayIconos[$nivel]["icono"];
     $expandedIcon = $this->arrayIconos[$nivel]["iconoExpandido"];
     $onclick = !$this->soloFinales ? "{$this->funcionJSEscucha}(this,'{$codigo}');" : !$deriva == 1 ? "{$this->funcionJSEscucha}(this,'{$codigo}');" : "";
     $nodo = new HTML_TreeNode(array('text' => "{$codigo}: {$descripcion}", 'link' => "#", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => false), array('onclick' => "{$onclick} return false"));
     //'onexpand'=>"alert('expand')"
     if (is_array($array1)) {
         foreach ($array1 as $i => $item) {
             $nodo->addItem($this->crearNodos($item));
         }
     }
     return $nodo;
 }
Exemple #4
0
 /**
  * A method to return the HTML code needed to display a tree-based
  * menu of all the simulations.
  *
  * @return string A string containing the HTML code needed to display
  *                the tests in a tree-based menu.
  */
 function buildTree()
 {
     $menu = new HTML_TreeMenu();
     $rootNode = new HTML_TreeNode(array('text' => 'OpenX Developer Toolbox', 'icon' => '', 'link' => 'action.php?action=index', 'linkTarget' => 'right'));
     $aItems[] = array('title' => 'Plugins', 'action' => 'about&item=plugins', 'children' => array(0 => array('title' => 'New Plugin', 'action' => 'create_plugin')));
     $aItems[] = array('title' => 'Schemas', 'action' => 'about&item=schema', 'children' => array(0 => array('title' => 'Schema Editor', 'action' => 'schema_editor'), 1 => array('title' => 'Changeset Archives', 'action' => 'schema_changesets')));
     $aItems[] = array('title' => 'Core Schema Utilities', 'action' => 'about&item=core_utils', 'children' => array(0 => array('title' => 'Integrity Check', 'action' => 'schema_integ'), 1 => array('title' => 'Dump Data', 'action' => 'schema_datadump'), 2 => array('title' => 'Load Data', 'action' => 'schema_dataload')));
     $aItems[] = array('title' => 'Schema Analysis', 'action' => 'schema_analysis');
     // Generate DataObjects
     $aDataObjects[] = array('title' => 'OpenX Core', 'action' => 'generate_dataobjects');
     $plugins = $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'];
     foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) {
         $schema = strtolower($name);
         $aDataObjects[] = array('title' => $name, 'action' => "generate_dataobjects&schema={$plugins}{$name}/etc/tables_{$schema}.xml&dbopath={$plugins}{$name}/etc/DataObjects");
     }
     $aItems[] = array('title' => 'Generate DataObjects', 'action' => 'about&item=dataobjects', 'children' => $aDataObjects);
     // Upgrade Packages
     $aPackages[] = array('title' => 'New Core Upgrade Package', 'action' => 'upgrade_package&name=OpenXCore');
     foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) {
         $aPackages[] = array('title' => $name, 'action' => 'upgrade_package&name=' . $name);
     }
     $aItems[] = array('title' => 'Upgrade Packages', 'action' => 'about&item=upgrade_packages', 'children' => $aPackages);
     // Upgrade Packages Array
     $aUpgrades[] = array('title' => 'OpenX Core', 'action' => 'upgrade_array&read=/etc/changes&write=/etc/changes/openads_upgrade_array.txt');
     foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) {
         $aUpgrades[] = array('title' => $name, 'action' => "upgrade_array&read={$plugins}{$name}/etc/changes&write={$plugins}{$name}/etc/changes/{$name}_upgrade_array.txt");
     }
     $aItems[] = array('title' => 'Upgrade Packages Array', 'action' => 'about&item=upgrade_array', 'children' => $aUpgrades);
     foreach ($aItems as $aItem) {
         $newNode =& $rootNode->addItem(new HTML_TreeNode(array('text' => $aItem['title'], 'icon' => 'package.png', 'link' => 'action.php?action=' . $aItem['action'], 'linkTarget' => 'right')));
         if (isset($aItem['children'])) {
             foreach ($aItem['children'] as $aChild) {
                 $newNode->addItem(new HTML_TreeNode(array('text' => $aChild['title'], 'icon' => 'Method.png', 'link' => 'action.php?action=' . $aChild['action'], 'linkTarget' => 'right')));
             }
         }
     }
     $menu->addItem($rootNode);
     $options = array('images' => 'assets/images');
     $tree = new HTML_TreeMenu_DHTML($menu, $options);
     $code = file_get_contents(PATH_ASSETS . '/css/menu.css');
     $code .= "\n<script>\n";
     $code .= file_get_contents(PATH_ASSETS . '/js/TreeMenu.js');
     $code .= "\n</script>";
     $code .= $tree->toHTML();
     return $code;
 }
 /**
  * A method to return the HTML code needed to display a tree-based
  * menu of all the OpenX tests.
  *
  * @return string A string containing the HTML code needed to display
  *                the tests in a tree-based menu.
  */
 function buildTree()
 {
     preg_match('/^(\\d+\\.\\d+)/', VERSION, $aMatches);
     // Create the root of the test suite
     $menu = new HTML_TreeMenu();
     $rootNode = new HTML_TreeNode(array('text' => PRODUCT_NAME . ' ' . $aMatches[1] . ' Tests', 'icon' => "package.png"));
     // Create the top-level test groups
     foreach ($GLOBALS['_MAX']['TEST']['groups'] as $type) {
         $nodeName = $type . 'RootNode';
         ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type) . ' Test Suite', 'icon' => "package.png", 'link' => "run.php?type={$type}&level=all", 'linkTarget' => "right"));
         $structure = TestFiles::getAllTestFiles($type);
         foreach ($structure as $layerCode => $folders) {
             $firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $GLOBALS['_MAX']['TEST'][$type . '_layers'][$layerCode][0], 'icon' => "package.png", 'link' => "run.php?type={$type}&level=layer&layer={$layerCode}", 'linkTarget' => 'right')));
             foreach ($folders as $folder => $files) {
                 if (count($files)) {
                     $secondNode =& $firstNode->addItem(new HTML_TreeNode(array('text' => $folder, 'icon' => "class_folder.png", 'link' => "run.php?type={$type}&level=folder&layer={$layerCode}&folder={$folder}", 'linkTarget' => 'right')));
                 }
                 foreach ($files as $index => $file) {
                     $secondNode->addItem(new HTML_TreeNode(array('text' => $file, 'icon' => "Method.png", 'link' => "run.php?type={$type}&level=file&layer={$layerCode}&folder={$folder}&file={$file}", 'linkTarget' => 'right')));
                 }
             }
         }
         $rootNode->addItem(${$nodeName});
     }
     /**
      * @TODO Clean up the following code to ensure that adding new
      *       PEAR PHPUnit tests to the test suite is easier!
      */
     // Create the PEAR PHPUnit tests
     $nodeName = 'PearRootNode';
     ${$nodeName} = new HTML_TreeNode(array('text' => 'PEAR PHPUnit Test Suite', 'icon' => "package.png", 'link' => "", 'linkTarget' => "right"));
     $firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => 'PEAR::MDB2', 'icon' => "package.png", 'link' => "run.php?type=phpunit&dir=../lib/pear/MDB2/tests", 'linkTarget' => 'right')));
     $firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => 'PEAR::MDB2_Schema', 'icon' => "package.png", 'link' => "run.php?type=phpunit&dir=../lib/pear/MDB2_Schema/tests", 'linkTarget' => 'right')));
     $rootNode->addItem(${$nodeName});
     // Add the root node to the menu, and return the HTML code
     $menu->addItem($rootNode);
     $tree = new HTML_TreeMenu_DHTML($menu);
     $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css');
     $code .= "\n<script>\n";
     $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js');
     $code .= "\n</script>";
     $code .= $tree->toHTML();
     return $code;
 }
function &recurseDir($path)
{
    if (!($dir = opendir($path))) {
        return false;
    }
    $files = array();
    $node = new HTML_TreeNode(basename($path), basename($path), 'folder.gif');
    while (($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (@is_dir("{$path}/{$file}")) {
                $addnode =& recurseDir("{$path}/{$file}");
            } else {
                $addnode = new HTML_TreeNode($file, $file, 'document2.png');
            }
            $node->addItem($addnode);
        }
    }
    closedir($dir);
    return $node;
}
Exemple #7
0
 /**
  * A method to return the HTML code needed to display a tree-based
  * menu of all the simulations.
  *
  * @return string A string containing the HTML code needed to display
  *                the tests in a tree-based menu.
  */
 function buildTree()
 {
     $icon_pkg = "package.png";
     // Create the root of the test suite
     $menu = new HTML_TreeMenu();
     $rootNode = new HTML_TreeNode(array('text' => 'Simulation Scenarios', 'icon' => $icon_pkg, 'link' => 'home.php', 'linkTarget' => 'right'));
     // Create the top-level test groups
     $aTypes = array(SCENARIOS => 'menu.php');
     foreach ($aTypes as $type => $link) {
         $nodeName = $type . 'RootNode';
         ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type), 'icon' => $icon_pkg, 'link' => $link, 'linkTarget' => "left"));
         $scenarios = get_file_list($type, '.php');
         foreach ($scenarios as $index => $scenario) {
             ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $scenario, 'icon' => $icon_pkg, 'link' => "action.php?dir={$type}&scenario={$scenario}", 'linkTarget' => 'right')));
         }
         $rootNode->addItem(${$nodeName});
     }
     $aParams = array('text' => 'Actions', 'icon' => $icon_pkg, 'link' => "", 'linkTarget' => "right");
     // create the Actions node
     $nodeName = 'ActionsRootNode';
     ${$nodeName} = new HTML_TreeNode($aParams);
     $rootNode->addItem(${$nodeName});
     $aParams['text'] = 'Save Current Scenario';
     $aParams['link'] = 'action.php?act=save';
     ${$nodeName}->addItem(new HTML_TreeNode($aParams));
     $aParams['text'] = 'Download Scenario/s';
     $aParams['link'] = 'action.php?act=download';
     ${$nodeName}->addItem(new HTML_TreeNode($aParams));
     $aParams['text'] = 'Upload Scenario/s';
     $aParams['link'] = 'action.php?act=upload';
     ${$nodeName}->addItem(new HTML_TreeNode($aParams));
     // Add the root node to the menu, and return the HTML code
     $menu->addItem($rootNode);
     $tree = new HTML_TreeMenu_DHTML($menu);
     $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css');
     $code .= "\n<script>\n";
     $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js');
     $code .= "\n</script>";
     $code .= $tree->toHTML();
     return $code;
 }
Exemple #8
0
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
// |                                                                       |
// +-----------------------------------------------------------------------+
// | Author: Richard Heyes <http://www.phpguru.org/>                       |
// |         Harald Radi <*****@*****.**>                              |
// +-----------------------------------------------------------------------+
//
// $Id: example.php,v 1.14 2005/03/02 02:16:51 richard Exp $
//error_reporting(E_ALL | E_STRICT);
//require_once('HTML/TreeMenu.php');
require_once '../TreeMenu.php';
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
$menu = new HTML_TreeMenu();
$node1 = new HTML_TreeNode(array('text' => "First level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true), array('onclick' => "alert('foo'); return false", 'onexpand' => "alert('Expanded')"));
$node1_1 =& $node1->addItem(new HTML_TreeNode(array('text' => "Second level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
$node1_1_1 =& $node1_1->addItem(new HTML_TreeNode(array('text' => "Third level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
$node1_1_1_1 =& $node1_1_1->addItem(new HTML_TreeNode(array('text' => "Fourth level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
$node1_1_1_1->addItem(new HTML_TreeNode(array('text' => "Fifth level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'cssClass' => 'treeMenuBold')));
$node1->addItem(new HTML_TreeNode(array('text' => "Second level, item 2", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
$node1->addItem(new HTML_TreeNode(array('text' => "Second level, item 3", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
$menu->addItem($node1);
$menu->addItem($node1);
// Create the presentation class
$treeMenu =& new HTML_TreeMenu_DHTML($menu, array('images' => '../images', 'defaultClass' => 'treeMenuDefault'));
$listBox =& new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self'));
//$treeMenuStatic = &new HTML_TreeMenu_staticHTML($menu, array('images' => '../images', 'defaultClass' => 'treeMenuDefault', 'noTopLevelImages' => true));
?>
<html>
<head>
Exemple #9
0
 function DirNode($text = false, $link = false, $icon = false, $path, $events = array())
 {
     $this->path = $path;
     $options = array();
     if ($text) {
         $options['text'] = $text;
     }
     if ($link) {
         $options['link'] = $link;
     }
     if ($icon) {
         $options['icon'] = $icon;
     }
     HTML_TreeNode::HTML_TreeNode($options, $events);
 }
 if ($base_add != '') {
     $source = $svn->cat->run($args);
     if (substr($base_add, -4) == '.php') {
         highlight_string($source);
     } else {
         echo '<pre>' . htmlentities($source, ENT_NOQUOTES) . "</pre>\n";
     }
 } else {
     // TreeMenu setup
     require_once 'HTML/TreeMenu.php';
     // Change icons to appropriate names
     // See HTML_TreeMenu docs for more details.
     $foldericon = 'aquafolder.gif';
     $docicon = 'bbedit_doc.gif';
     $menu = new HTML_TreeMenu();
     $node1 = new HTML_TreeNode(array('text' => 'VersionControl_SVN', 'icon' => $foldericon));
     $list = $svn->list->run($args, $switches);
     foreach ($list['list'][0]['entry'] as $item) {
         $dir = dirname($item['name']);
         if ($item['kind'] !== 'file') {
             $icon = $foldericon;
             $link = '';
         } else {
             $icon = $docicon;
             $link = $_SERVER['PHP_SELF'] . "/" . $item['name'];
             // don't need the link for the .
             $link = str_replace('/.', '', $link);
         }
         if ($dir == '.') {
             // Adding to root level
             $obj = basename($item['name']);
 function HTML_TreeNodeXL()
 {
     HTML_TreeNode::HTML_TreeNode();
     $numargs = func_num_args();
     $numargs = min(6, $numargs);
     $arglist = array('text', 'link', 'icon', 'expanded', 'isDynamic', 'cssClass');
     for ($i = 0; $i < $numargs; $i++) {
         $a =& func_get_arg($i);
         if (is_array($a)) {
             // Array is always the last argument.  Ignore anything else.
             $this->setProperties($a);
             break;
         }
         $this->{$arglist}[$i] = $a;
     }
     $this->_checkProperties();
 }
Exemple #12
0
if ( $conf['debug'] == 1 ) {
  print "UserID:".$_SESSION['__auth']['userID']."<BR>";
  print "APP_BASE: ".APP_BASE."<BR>";
  print "FRAMEWORK_BASE: ".FRAMEWORK_BASE."<BR>";
}

global $conf;
global $applications;

// use TreeMenu
require_once(FRAMEWORK_BASE.'/lib/TreeMenu.php');
$icon = 'stock_open16.gif';
$level_count = 0;
$menu  = new HTML_TreeMenu();
$root = new HTML_TreeNode(array('text' => "dnsZone-Manager",
                                 'icon' => $icon));

$top_level = LDAP_functions::my_ldap_search('objectclass=dcObject', '', array( "dc" ), 'one', 'dc');

if (is_array($top_level) && (count($top_level) > 1)) { 
  foreach ($top_level as $value) {
    if ( $value['dc'][0] ) {
      
      $level[$level_count] = &$root->addItem( new HTML_TreeNode(array('text' => $value['dc'][0],
      					                             'icon' => $icon)));
      
      $domain_level = LDAP_functions::my_ldap_search('(& (objectclass=domain) (description=ActiveDomain*))', 
                                                     $value['dn'],
						     array( "*" ));
      if ( $conf['debug'] == 1 ) {
        print "Domain Level: ".count($domain_level)." is array? ".is_array($domain_level)."<br/>";
Exemple #13
0
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
$iconp780 = 'p780.gif';
$iconAix = 'aix.gif';
$iconCPU = 'cpu.gif';
$iconMem = 'mem.gif';
$iconIO = 'io.gif';
$iconNet = 'net.gif';
$iconDisk = 'disk.gif';
$iconFs = 'fs.gif';
$iconCP = 'cpupool.gif';
$iconAvg = 'avg.gif';
$iconSea = 'sea.gif';
$iconTux = 'tux.gif';
$menu = new HTML_TreeMenu();
$node1 = new HTML_TreeNode(array('text' => "All Systems", 'link' => "", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true), array('onclick' => "alert('All Systems'); return false"));
//$sql = "select host,os,serial from hosts order by os,serial";
$sql = "select host,os,serial,b.value,vio from hosts a left join parameter b on a.serial=b.param order by os,b.value,host";
$prevos = '';
$prevserial = '';
$nodeOS = '';
foreach ($conn->query($sql) as $row) {
    if (!$row['os']) {
        continue;
    }
    if ($prevos != $row['os']) {
        $nodeOS =& $node1->addItem(new HTML_TreeNode(array('text' => $row['os'], 'link' => "", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true)));
        if ($row['os'] == 'AIX') {
            $nodeTCPUAvg =& $nodeOS->addItem(new HTML_TreeNode(array('text' => 'Total Usage Averages', 'link' => "allavg.php", 'icon' => $iconp, 'expandedIcon' => $expandedIcon, 'expanded' => true)));
        }
        $prevos = $row['os'];
Exemple #14
0
/**
 * Recursively builds a dynamic tree menu for seleting the categories to filter
 * search results by.
 *
 * @param array  $cats     An array of category objects from the DB.
 * @param array  $selected An array of currently selected category IDs.
 * @param string $baseurl  The base URL that this menu is being displayed on.
 * @return array An array of completed HTML_TreeMenu nodes.
 */
function repository_alfresco_make_category_select_tree_browse($cats, $selected = array(), $baseurl = '')
{
    global $CFG;
    global $repo;
    static $catlist;
    if (empty($cats)) {
        return;
    }
    $icon = 'folder.gif';
    $eicon = 'folder-expanded.gif';
    $nodes = array();
    /// Get the list of all the categories we actually need to display here
    if (!isset($catlist)) {
        $catlist = repository_alfresco_make_category_tree();
    }
    $catfilter = repository_alfresco_get_category_filter();
    for ($i = 0; $i < count($cats); $i++) {
        if (!empty($catlist) && !array_key_exists($cats[$i]->id, $catlist)) {
            continue;
        }
        if (empty($catfiler) || in_array($cats[$i]->id, $catfilter)) {
            if (in_array($cats[$i]->id, $selected)) {
                $checked = ' checked';
            } else {
                $checked = '';
            }
            $text = '<input type="checkbox" name="categories[]" value="' . $cats[$i]->id . '"' . $checked . ' /> ';
        }
        if (!empty($baseurl)) {
            $text .= '<a href="' . $baseurl . '&amp;search=*&amp;category=' . $cats[$i]->id . '">' . $cats[$i]->title . '</a>';
        } else {
            $text .= $cats[$i]->title;
        }
        $node = new HTML_TreeNode(array('text' => $text, 'icon' => $icon, 'expandedIcon' => $eicon, 'expanded' => false));
        if ($children = $repo->category_get_children($cats[$i]->id)) {
            if ($cnodes = repository_alfresco_make_category_select_tree_browse($children, $selected, $baseurl)) {
                for ($j = 0; $j < count($cnodes); $j++) {
                    $node->addItem($cnodes[$j]);
                }
            }
        }
        $nodes[] = $node;
    }
    return $nodes;
}
 /**
  * Private function to handle ensureVisible stuff
  *
  * @return void
  * @access private
  */
 function _ensureVisible()
 {
     $this->ensureVisible = true;
     $this->expanded = true;
     if (!is_null($this->parent)) {
         $this->parent->_ensureVisible();
     }
 }
Exemple #16
0
/**
* Recursively builds a dynamic tree menu for seleting the categories to filter
* search results by.
*
* @param array  $cats     An array of category objects from the DB.
* @param array  $selected An array of currently selected category IDs.
* @return array An array of completed HTML_TreeMenu nodes.
*/
    function make_root_folder_select_tree($folders = false, $path = '') {
        global $CFG;

        if (ELIS_FILES_DEBUG_TRACE) mtrace('make_root_folder_select_tree()');

        if (empty($folders) && (!$folders = elis_files_folder_structure())) {
            return false;
        }

        $icon  = 'folder.gif';
        $eicon = 'folder-expanded.gif';
        $nodes = array();

        foreach ($folders as $i => $folder) {
            $npath = $path . '/' . $folder['name'];

            $text = ' <a href="#" onclick="set_value(\\\'' . $npath . '\\\')" title="' . $npath . '">' . $folder['name'] .
                    (!empty(elis::$config->elisfiles->root_folder) && elis::$config->elisfiles->root_folder == $npath ?
                    ' <span class="pathok">&#x2714;</span>' : '') . '</a>';

            $node = new HTML_TreeNode(array(
                'text'         => $text,
                'icon'         => $icon,
                'expandedIcon' => $eicon,
                'expanded'     => false
            ));

            if (!empty($folder['children'])) {
                if ($cnodes = $this->make_root_folder_select_tree($folder['children'], $npath)) {
                    for ($j = 0; $j < count($cnodes); $j++) {
                        $node->addItem($cnodes[$j]);
                    }
                }
            }

            $nodes[] = $node;
        }

        return $nodes;
    }