Beispiel #1
0
/**
 * Function to recurse thru the tree adding nodes to treemenu
 */
function parseTree(&$structure, $parent = null)
{
    global $dbh;
    $parent = is_null($parent) ? 'IS NULL' : '= ' . $parent;
    // Get categories
    $categories = $dbh->getAll(sprintf('SELECT id, parent, name, description, npackages ' . 'FROM categories WHERE parent %s ORDER BY name, id', $parent), null, DB_FETCHMODE_ASSOC);
    if (count($categories)) {
        foreach ($categories as $cat) {
            $newNode =& $structure->addItem(new HTML_TreeNode(array('text' => htmlspecialchars($cat['name']), 'icon' => 'folder.gif'), array('onclick' => 'category_click(event, this, ' . $cat['id'] . ')')));
            parseTree($newNode, $cat['id']);
        }
    }
}
Beispiel #2
0
function parseTree($root = 0)
{
    global $tree;
    $return = array();
    # Traverse the tree and search for direct children of the root
    foreach ($tree as $dep_id => $dep_info) {
        # A direct child is found
        if ($dep_info[4] == $root) {
            # Remove item from tree (we don't need to traverse this again)
            unset($tree[$dep_id]);
            # Append the child into result array and parse its children
            $return[] = array('name' => $dep_info, 'children' => parseTree($dep_id));
        }
    }
    return empty($return) ? null : $return;
}
Beispiel #3
0
function ParseTree($tree, $root = null)
{
    MarkTime("ParseTree()");
    $return = array();
    # Traverse the tree and search for direct children of the root
    foreach ($tree as $child => $par) {
        # A direct child is found
        foreach ($par as $parent) {
            if ($parent == $root) {
                # Remove item from tree (we don't need to traverse this again)
                unset($tree[$child]);
                # Append the child into result array and parse its children
                $return[] = array('pipeline_id' => $child, 'child_id' => parseTree($tree, $child));
            }
        }
    }
    return empty($return) ? null : $return;
}
Beispiel #4
0
<?php

$imagePath = "albums";
//  path where you have the preview image tree (the large images in photofolio)
$imgIndexFilename = "imgindex.xml";
print "<head><title>Photofolio Build Index ||<title></head>";
print "<body>";
print "<font face='arial, helvetica' size='medium'><B>Creating imgindex.xml from from the directory structure of your site. . .  please wait<B></font><br>";
print "<HR width='400' height='1' align='left'>";
print "<table  width='400' border='0' cellspacing='0' cellpadding='2'>";
$xmlString = "<albums>\n";
$xmlString .= parseTree($imagePath);
$xmlString .= "</albums>\n";
//print 'the xml string is: ' . $xmlString;
//print $xmlString;
// Open the file and erase the contents if any
$fp = fopen("{$imgIndexFilename}", "w");
// Write the data to the file
fwrite($fp, $xmlString);
// Close the file
fclose($fp);
print "<p></p><font face='arial, helvetica' size='medium'><strong>DONE!</strong></font>";
//////////////////////////  START FUNCTIONS
function parseTree($tempFolderPath)
{
    $dir = opendir("{$tempFolderPath}");
    while (false !== ($album = readdir($dir))) {
        if ($album != "." && $album != "..") {
            $thisImagePath = $tempFolderPath . "/" . $album;
            //print $thisImagePath . " is here<br>";
            $innerdir = opendir("{$thisImagePath}");
function parseTree($root, $arr)
{
    $return = array();
    # Traverse the tree and search for direct children of the root
    foreach ($arr as $child => $parent) {
        # A direct child is found
        if ($parent == $root) {
            # Remove item from tree (we don't need to traverse this again)
            unset($arr[$child]);
            # Append the child into result array and parse it's children
            $return[] = array('name' => $child, 'children' => parseTree($child, $arr));
        }
    }
    return empty($return) ? null : $return;
}
Beispiel #6
0
        </section>

        <!-- Main content -->
        <section class="content">

 <!-- Default box -->
          <div class="box">
            <div class="box-header with-border">
              <h3 class="box-title">Chart of Accounts</h3> <a href="<?php 
echo SITE_ROOT;
?>
?route=modules/gl/setup/coa/add_coa" class="btn btn-primary btn-sm" ><i class="fa fa-plus"></i>&nbsp Add New Account</a>
              <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i class="fa fa-minus"></i></button>
                <button class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove"><i class="fa fa-times"></i></button>
              </div>
            </div>
            <div class="box-body">
			 
				 <?php 
printTree($list);
$result1 = parseTree(null, $list);
printTree($result1);
?>
			 
            </div><!-- /.box-body -->
            <div class="box-footer">
             <small> Please do not make changes to these unless you are really sure what you are doing. making changes here have system wide impact</small>
            </div><!-- /.box-footer-->
          </div><!-- /.box -->
     	 </section><!-- /.content -->