コード例 #1
0
ファイル: edit.inc.php プロジェクト: entire-media/comator
function do_delete()
{
    global $delete, $conn, $modul;
    if ($delete) {
        preg_match("/(.*)_(.*)/i", $modul, $alter_modul);
        if (isset($alter_modul[2])) {
            if ($alter_modul[2] == 'fields') {
                $sql = "SELECT title, c_default FROM " . $_SESSION['TABLE_PREFIX'] . $modul . " WHERE id='" . $delete . "' ";
                $result = db_mysql_query($sql, $conn);
                $arr = db_mysql_fetch_array($result);
                if ($arr['c_default'] == '1') {
                    unset($delete);
                } else {
                    $sql = "ALTER TABLE " . $_SESSION['TABLE_PREFIX'] . $alter_modul[1] . " \n\t\t\t\t\t\t\t\t\tDROP COLUMN " . $arr['title'] . " ";
                    db_mysql_query($sql, $conn);
                }
            }
            if ($alter_modul[2] == 'tree') {
                $data = array();
                $sql = "SELECT id, title, id_parent, sort_order FROM " . $_SESSION['TABLE_PREFIX'] . $modul . " WHERE c_active = '1' ORDER BY sort_order ASC ";
                $result = db_mysql_query($sql, $conn);
                while ($arr = db_mysql_fetch_array($result)) {
                    $data[$arr['id']] = $arr;
                }
                delete_tree($alter_modul[1], build_tree($data, $delete), $delete);
                $sql = "DELETE FROM " . $_SESSION['TABLE_PREFIX'] . $alter_modul[1] . " WHERE id_tree = '" . $delete . "' ";
                db_mysql_query($sql, $conn);
            }
        }
        if (isset($delete)) {
            $sql = "DELETE FROM " . $_SESSION['TABLE_PREFIX'] . $modul . " WHERE id = '" . $delete . "' ";
            db_mysql_query($sql, $conn);
        }
    }
}
コード例 #2
0
 /**
  * @dataProvider mydataProvider
  */
 public function test_compareTree($expr1, $expr2, $result)
 {
     global $typeOfVars;
     $tree1 = build_tree($expr1, $typeOfVars);
     $tree2 = build_tree($expr2, $typeOfVars);
     $this->assertEquals($result, is_tree_equal($tree1, $tree2, FALSE));
 }
コード例 #3
0
ファイル: static.php プロジェクト: cdlabal/doc
function generate_static($out_dir)
{
    global $tree, $base, $docs_path, $output_path, $options, $mode, $multilanguage, $output_language;
    $mode = 'Static';
    if ($out_dir === '') {
        $output_path = $base . '/static';
    } else {
        if (substr($out_dir, 0, 1) !== '/') {
            $output_path = $base . '/' . $out_dir;
        } else {
            $output_path = $out_dir;
        }
    }
    clean_copy_assets($output_path);
    build_tree();
    if (!$multilanguage) {
        generate_static_branch($tree, '');
    } else {
        foreach ($options['languages'] as $languageKey => $language) {
            $output_language = $languageKey;
            generate_static_branch($tree[$languageKey], $languageKey);
        }
    }
    $index = $docs_path . '/index.md';
    if (is_file($index)) {
        $index = generate_page($index);
        file_put_contents($output_path . '/index.html', $index);
    }
}
コード例 #4
0
ファイル: main.php プロジェクト: anhptvolga/normalandcomp
function process_each_expression($filename, $filegv)
{
    try {
        $exp = readExp($filename);
        $tree = build_tree($exp);
        // преобразовать
        $tree->ptonewchild = null;
        $tree->convert($tree);
        while ($tree->ptonewchild != null) {
            $tree = $tree->ptonewchild;
            $tree->ptonewchild = null;
            $tree->convert($tree);
        }
        // печать DOT файл
        $file = fopen($filegv, "w");
        fwrite($file, "digraph {\n");
        print_tree_to_dot($file, $tree);
        fwrite($file, '}');
        fclose($file);
        return $tree;
    } catch (Exception $e) {
        echo "In file {$filename}: " . $e->getMessage() . " \n";
        return null;
    }
}
 /**
  * Build tree
  *
  * Creates adjacency list based on group id or slug
  *
  * @param mixed $group      Group id or slug
  * @param array $attributes Any attributes
  * @param array &$tree      Tree array
  *
  * @return string
  */
 function build_tree($group, $attributes = array(), &$tree = array())
 {
     if (empty($tree)) {
         $CI =& get_instance();
         $CI->load->library('adjacency_list');
         $tree = $CI->adjacency_list->get_all($group);
         $tree = parse_children($tree);
     }
     foreach (array('start_tag' => '<li>', 'end_tag' => '</li>', 'sub_start_tag' => '<ul>', 'sub_end_tag' => '</ul>') as $key => $val) {
         $atts[$key] = !isset($attributes[$key]) ? $val : $attributes[$key];
         unset($attributes[$key]);
     }
     $output = '';
     if (!empty($tree)) {
         foreach ($tree as &$leaf) {
             $leaf['name'] = htmlspecialchars($leaf['name'], ENT_QUOTES, 'UTF-8');
             if (isset($leaf['children']) && !empty($leaf['children'])) {
                 $output .= $atts['start_tag'] . '<a href="' . $leaf['url'] . '">' . $leaf['name'] . '</a>';
                 $output .= $atts['sub_start_tag'] . build_tree($group, $attributes, $leaf['children']) . $atts['sub_end_tag'];
                 $output .= $atts['end_tag'];
             } else {
                 $output .= $atts['start_tag'] . '<a href="' . $leaf['url'] . '">' . $leaf['name'] . '</a>' . $atts['end_tag'];
             }
         }
     }
     return $output;
 }
コード例 #6
0
function build_tree($person, $henry, $level, $total)
{
    // Recursive routine that does the major work.
    global $coparents, $descendants;
    $maxlevel = 15;
    $count = 0;
    $family = find_family($person);
    while (isset($family[$count][0])) {
        $coparent = $family[$count][1];
        $coparents++;
        printf("<li>~ %s\n<ul class=\"descendants\">\n", get_name_and_dates('', $coparent));
        while (isset($family[$count][1]) && $family[$count][1] == $coparent) {
            $henry[$level] = $count + 1;
            $descendants++;
            printf("<li>%s %s", get_henry($henry, $level), get_name_and_dates('', $family[$count][0]));
            if ($level == $maxlevel && has_descendants($family[$count][0])) {
                print " <strong>+</strong>";
            }
            print "</li>\n";
            if ($level < $maxlevel) {
                // point of recursion
                build_tree($family[$count][0], $henry, $level + 1, $total);
            }
            $count++;
        }
        echo "</ul></li>\n";
    }
    return;
}
コード例 #7
0
 /**
  * @dataProvider mydataProvider
  */
 public function test_convert($expr1, $expr2)
 {
     global $typeOfVars;
     $tree1 = build_tree($expr1, $typeOfVars);
     $tree2 = build_tree($expr2, $typeOfVars);
     $tree1->ptonewchild = null;
     $tree1->convert($tree1);
     while ($tree1->ptonewchild != null) {
         $tree1 = $tree1->ptonewchild;
         $tree1->ptonewchild = null;
         $tree1->convert($tree1);
     }
     $file = fopen("tree2.gv", "w");
     fwrite($file, "digraph {\n");
     print_tree_to_dot($file, $tree2);
     fwrite($file, '}');
     fclose($file);
     $tree2->ptonewchild = null;
     $tree2->convert($tree2);
     while ($tree2->ptonewchild != null) {
         $tree2 = $tree2->ptonewchild;
         $tree2->ptonewchild = null;
         $tree2->convert($tree2);
     }
     $file = fopen("tree1.gv", "w");
     fwrite($file, "digraph {\n");
     print_tree_to_dot($file, $tree1);
     fwrite($file, '}');
     fclose($file);
     $this->assertTrue(is_tree_equal($tree1, $tree2, TRUE));
     $tree1->delete_childrens();
     $tree2->delete_childrens();
     unset($tree1);
     unset($tree2);
 }
コード例 #8
0
 /**
  * @dataProvider mydataProvider
  */
 public function test_openbracket($expr1, $expr2)
 {
     global $typeOfVars;
     $tree1 = build_tree($expr1, $typeOfVars);
     $tree2 = build_tree($expr2, $typeOfVars);
     $opened = $tree1->open_bracket();
     $this->assertTrue(is_tree_equal($opened, $tree2, TRUE));
 }
コード例 #9
0
 /**
  * @dataProvider mydataProvider
  */
 public function test_sortchild($expr1, $expr2)
 {
     global $typeOfVars;
     $tree1 = build_tree($expr1, $typeOfVars);
     $tree2 = build_tree($expr2, $typeOfVars);
     $tree1->sort_childrens();
     $tree2->sort_childrens();
     $this->assertTrue(is_tree_equal($tree1, $tree2, FALSE));
 }
コード例 #10
0
 public function single($id)
 {
     $categorylist = M('article_category')->where(array("lang" => LANG_SET))->select();
     $tree = build_tree(0, $categorylist);
     $this->assign('categorylist', $tree);
     // 赋值数据集
     $article = M('article')->where("id='{$id}'")->select();
     $article[0]["category"] = M('article_category')->where(array("id" => $article[0]['category_id']))->select();
     $this->article = $article;
     $this->assign('currcategory', $article[0]["category"][0]);
     // 赋值数据集
     $this->theme("default")->display('Article/single');
 }
コード例 #11
0
 /**
  * @dataProvider mydataProvider
  */
 public function test_sortchild($expr1, $expr2)
 {
     global $typeOfVars;
     $tree1 = build_tree($expr1, $typeOfVars);
     $tree2 = build_tree($expr2, $typeOfVars);
     $tree1->convert_quine_mc_cluskey();
     $tmp;
     if (get_class($tree2) != 'qtype_correctwriting_or_logic_operator') {
         $tmp = new qtype_correctwriting_or_logic_operator();
         array_push($tmp->childrens, $tree2);
         $tree2 = $tmp;
     }
     $this->assertTrue(is_tree_equal($tree1, $tree2, TRUE));
 }
コード例 #12
0
ファイル: tree.inc.php プロジェクト: entire-media/comator
function build_tree(array &$elements, $id_parent = 0)
{
    $branch = array();
    foreach ($elements as &$element) {
        if ($element['id_parent'] == $id_parent) {
            $children = build_tree($elements, $element['id']);
            if ($children) {
                $element['children'] = $children;
            }
            $branch[$element['id']] = $element;
            unset($element);
        }
    }
    return $branch;
}
コード例 #13
0
 public function single($id)
 {
     $categorylist = M('product_category')->where(array("lang" => LANG_SET))->order(array("order" => "asc", "created" => "desc"))->select();
     $tree = build_tree(0, $categorylist);
     $this->assign('categorylist', $tree);
     // 赋值数据集
     $product = M('product')->where("id='{$id}'")->select();
     $arr = explode("||", $product[0]['img']);
     $product[0]["img"] = $arr;
     $this->product = $product;
     $currcategory = M('product_category')->where(array("id" => $product[0]['category_id']))->select();
     $after = M("product")->where("id>" . $id)->order('id asc')->limit('1')->find();
     $this->assign('after', $after);
     // 赋值数据集
     $this->assign('currcategory', $currcategory[0]);
     // 赋值数据集
     $this->theme("default")->display('Product/single');
 }
コード例 #14
0
 function build_tree($comments)
 {
     if ($comments) {
         $result = "<ul>\n";
         foreach ($comments as $comment) {
             $result .= "<li>";
             $result .= $comment->id;
             $result .= "</li>\n";
             //                    $count = Comment::findorFail(2)->childrens;
             $children = Comment::findorFail($comment->id)->childrens;
             if (isset($children)) {
                 $result .= build_tree($children);
             }
             $result .= "</li>\n";
         }
         $result .= "</ul>";
         return $result;
     }
 }
コード例 #15
0
ファイル: dev_helper.php プロジェクト: xdevteam/renovation
function build_tree($category_id, $lang, $addon)
{
    $CI =& get_instance();
    $rtrn = '<ul id="cat_' . $category_id . '" style="display:none;">';
    $CI->db->order_by('name', 'asc');
    // Сортируем названию
    $CI->db->order_by('pos', 'asc');
    // Сортируем по позиции
    $CI->db->where('lang', $lang);
    // Берем только русские
    $CI->db->where('cat_id', $category_id);
    $data = $CI->db->get('categories')->result_array();
    foreach ($data as $item) {
        $rtrn .= '<li ' . $addon . '><a href="' . base_url() . 'ru/catalog/' . $item['url'] . '"  title="' . $item['meta_title'] . '"> <i class="fa fa-angle-right" style="margin-right: 17px; color: c8c8c8; display: inline;"></i> ' . $item['name'] . '</a>';
        if (count($CI->db->where('cat_id', $item['id'])->get('categories')->result()) > 0) {
            $rtrn .= '<span style="position:absolute; right:0px; top:7px; display:block; float:right; clear:none; z-index:1; width:27px; height:27px; cursor:pointer; font-weight:bold; color:#bcbcbc; font-size:12px;"><i class="fa fa-plus-circle"></i></span>';
        }
        $rtrn .= '' . build_tree($item['id'], $lang, "style=\"padding-left:10px;\"") . '
				</li>';
    }
    return $rtrn . '</ul>';
}
コード例 #16
0
ファイル: map.php プロジェクト: slavam/placement
function build_tree($cats, $parent_id, $only_parent = false)
{
    if (is_array($cats) and isset($cats[$parent_id])) {
        $tree = '<ul>';
        if ($only_parent == false) {
            foreach ($cats[$parent_id] as $cat) {
                $tree .= '<li>' . $cat['name'] . ' #' . $cat['id'];
                $tree .= build_tree($cats, $cat['id']);
                $tree .= '</li>';
            }
        } elseif (is_numeric($only_parent)) {
            $cat = $cats[$parent_id][$only_parent];
            $tree .= '<li>' . $cat['name'] . ' #' . $cat['id'];
            $tree .= build_tree($cats, $cat['id']);
            $tree .= '</li>';
        }
        $tree .= '</ul>';
    } else {
        return null;
    }
    return $tree;
}
コード例 #17
0
ファイル: function.php プロジェクト: klmnprst/shop
function build_tree($arr, $parent, $id = '')
{
    if (is_array($arr) and isset($arr[$parent])) {
        if (empty($id)) {
            $tree = "\n<ul>";
        } else {
            $tree = "\n" . '<ul class=' . $id . '>' . "\n";
        }
        foreach ($arr[$parent] as $key => $value) {
            if ($value['url'] == '/') {
                $value['url'] = '';
            }
            $tree .= '<li><a href="/' . $value['url'] . '">' . $value['name'] . '</a>';
            $tree .= build_tree($arr, $key);
            $tree .= "</li>\n";
        }
        $tree .= "<div class=\"clear\"></div></ul>\n";
    } else {
        return null;
    }
    return $tree;
}
コード例 #18
0
 public function single($id, $s = "")
 {
     if (!is_numeric($id)) {
         $temp = M('page')->where(array("callcode='{$id}'", "lang" => LANG_SET))->find();
         $temp1 = M("page")->where(array("sub_id" => $temp['id']))->limit("1")->find();
         $s = $id;
         $id = $temp1['id'];
     }
     $article = M('page')->where(array("id='{$id}'", "lang" => LANG_SET))->select();
     $this->article = $article;
     $temo = M('page')->where(array("lang" => LANG_SET, "id" => $article[0]['id']))->select();
     $this->assign('currcategory', $temo[0]);
     // 赋值数据集
     //print_r($s);
     if ($s != "about" && $s != "channel" && $s != "support") {
         // $s = "about";
     }
     $this->assign("backup", $s);
     $categorylist = M('page')->where(array("lang" => LANG_SET, "_string" => "sub_id='" . $article[0]['sub_id'] . "' OR id = '" . $article[0]['sub_id'] . "'"))->select();
     $tree = build_tree(0, $categorylist);
     $this->assign('categorylist', $tree);
     // 赋值数据集
     $this->theme("default")->display('Page/index');
 }
コード例 #19
0
$csv = read_input($in, isset($argv[5]) ? $argv[5] : ',');
if ($mode == MODE_CSV) {
    print_r($csv);
    exit(1);
}
// Filter the CSV data for conversion
if (!@(include $filter)) {
    print_usage_and_exit("Could not include filter script {$in}");
}
if (!function_exists('custom_filter')) {
    print_error_and_exit("Filter function 'custom_filter' not " . "defined in filter script");
}
$cases = filter_csv_input($csv);
if ($mode == MODE_CASES) {
    print_r($cases);
    exit(1);
}
// Generate a section tree
$sections = build_tree($cases);
if ($mode == MODE_TREE) {
    print_r($sections);
    exit(1);
}
// Write the output
$handle = fopen($out, 'w');
if (!$handle) {
    print_error_and_exit('Could not create output file');
}
write_output($handle, $sections);
fclose($handle);
print "Successfully converted {$section_count} sections and {$case_count} cases\n";
コード例 #20
0
ファイル: copy.php プロジェクト: azeckoski/az-php-sandbox
/**
 * @param object $ldapserver
 * @param dn $dn
 * @param array $tree
 * @param string $filter
 */
function build_tree($ldapserver, $dn, $buildtree)
{
    if (DEBUG_ENABLED) {
        debug_log('build_tree: Entered with (%s,%s,%s)', 1, $ldapserver->server_id, $dn, $buildtree);
    }
    $children = $ldapserver->getContainerContents($dn, 0);
    if (is_array($children) && count($children) > 0) {
        $buildtree[$dn] = $children;
        foreach ($children as $child_dn) {
            $buildtree = build_tree($ldapserver, $child_dn, $buildtree);
        }
    }
    if (DEBUG_ENABLED) {
        debug_log('build_tree: Returning (%s)', 1, $buildtree);
    }
    return $buildtree;
}
コード例 #21
0
            <ul>
                <?php 
echo build_tree('languages');
?>
            </ul>
        </div>

        <div class="span8">
            <pre><code>
&lt;ol&gt;
    &lt;?php echo build_tree('languages', array('sub_start_tag' =&gt; '&lt;ol&gt;', 'sub_end_tag' =&gt; '&lt;/ol&gt;')); ?&gt;
&lt;/ol&gt;
            </code></pre>
            <ol>
                <?php 
echo build_tree('languages', array('sub_start_tag' => '<ol>', 'sub_end_tag' => '</ol>'));
?>
            </ol>
        </div>
    </div>
        <div class="row">
        <div class="span4">
            <pre><code>
&lt;ul&gt;
    &lt;?php echo build_tree_item('languages', 4); ?&gt;
&lt;/ul&gt;
            </code></pre>
            <ul>
                <?php 
echo build_tree_item('languages', 4);
?>
コード例 #22
0
ファイル: copy.php プロジェクト: gulikoza/phpLDAPadmin
function build_tree($server, $dn, $buildtree)
{
    if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
        debug_log('Entered (%%)', 1, 0, __FILE__, __LINE__, __METHOD__, $fargs);
    }
    # We search all children, not only the visible children in the tree
    $children = $server->getContainerContents($dn, null, 0);
    if (count($children)) {
        $buildtree[$dn] = $children;
        foreach ($children as $child_dn) {
            $buildtree = build_tree($server, $child_dn, $buildtree);
        }
    }
    if (DEBUG_ENABLED) {
        debug_log('Returning (%s)', 1, 0, __FILE__, __LINE__, __METHOD__, $buildtree);
    }
    return $buildtree;
}
コード例 #23
0
ファイル: function.php プロジェクト: songkang1/tp_yining
function build_tree($root_id, $rows)
{
    $childs = findChild($rows, $root_id);
    if (empty($childs)) {
        return null;
    }
    foreach ($childs as $k => $v) {
        $rescurTree = build_tree($v['id'], $rows);
        if (null != $rescurTree) {
            $childs[$k]['childs'] = $rescurTree;
        }
    }
    return $childs;
}
コード例 #24
0
function EditAlbum($allowed_edit)
{
    global $context, $txt, $smcFunc, $scripturl;
    $memID = $context['member']['id'];
    if (!$allowed_edit) {
        fatal_error($txt['Maximum_albums_edit_not'], false);
    }
    $request = $smcFunc['db_query']('', '
		SELECT title, parent_id 
		FROM {db_prefix}Maximum_albums 
		WHERE id_album = {int:id_album}', array('id_album' => (int) $_GET['editalb']));
    list($context['album_title'], $context['album_parent']) = $smcFunc['db_fetch_row']($request);
    $context['sub_template'] = 'albums_edit';
    $context['album_tree'] = build_tree($_GET['editalb']);
    $context['Maximum_action'] = $scripturl . '?action=profile;area=pictures;u=' . $memID . ';editalb2=' . $_GET['editalb'];
}
コード例 #25
0
ファイル: function.php プロジェクト: liutongju/photocms
function getmenu($pid = 0)
{
    if (!S('menu_' . $pid)) {
        $res = allmenu();
        $menu = build_tree($res, $pid);
        S('menu_' . $lid . '_' . $pid, $menu);
    } else {
        $menu = S('menu_' . $lid . '_' . $pid);
    }
    return $menu;
}
コード例 #26
0
    }
    if ($name[29]) {
        echo "<tr>{$eb}{$vl}{$vl}{$tm}{$red} 29 {$name['29']}</td>{$nl}{$vl}{$vl}{$ec}</tr>\n";
    }
    if ($name[7]) {
        echo "<tr>{$eb}{$tm}{$red} 7 {$name['7']}</td>{$eb}{$eb}{$nl}{$ec}</tr>\n";
    }
    if ($name[30]) {
        echo "<tr>{$eb}{$eb}{$vl}{$ec}{$blue} 30 {$name['30']}</td>{$nl}{$vl}{$tf}</tr>\n";
    }
    if ($name[15]) {
        echo "<tr>{$eb}{$eb}{$tm}{$red} 15 {$name['15']}</td>{$eb}{$nl}{$ec}</tr>\n";
    }
    if ($name[31]) {
        echo "<tr>{$eb}{$eb}{$eb}{$tm}{$red} 31 {$name['31']}</td>{$nl}{$ec}</tr>\n";
    }
    echo "</table>\n";
}
// *****************************************************************************
// ***                           MAIN PROGRAM                                ***
// *****************************************************************************
$pedigree = true;
$title = "{$person} {$name}, {$_ancestors}";
require "./header.php";
spousebox($person);
childbox($person);
echo '<div class="normal">';
echo "<h2>{$_Pedigree_for} {$name}</h2>\n";
build_tree($person);
echo "</div>\n";
include "./footer.php";
コード例 #27
0
ファイル: index.php プロジェクト: cdlabal/doc
    switch ($argv[1]) {
        //Generate static web documentation
        case 'generate':
            generate_static(isset($argv[3]) ? $argv[3] : '');
            echo "Finished\n";
            echo "The documentation is generated in static folder\n";
            break;
        default:
            echo "\n";
            echo 'Usage:' . "\n";
            echo ' php index.php generate' . "\n";
            echo 'Generate static web' . "\n";
            echo "\n";
            break;
    }
    exit;
}
require_once dirname(__FILE__) . "/libs/live.php";
$base_path = str_replace("/index.php", "", $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define("CLI", FALSE);
build_tree();
$remove = array($base_path . '/');
if (!$options['clean_urls']) {
    $remove[] = 'index.php?';
}
$request = str_replace($remove, "", $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$request = rawurldecode($request);
if (isset($_POST['markdown']) && $options['file_editor']) {
    file_put_contents(clean_url_to_file($request), $_POST['markdown']);
}
echo generate_live($request);
コード例 #28
0
ファイル: softwaremap.php プロジェクト: neymanna/fusionforge
				<?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 "&nbsp;";
    			}
    			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:
コード例 #29
0
ファイル: incomming.action.php プロジェクト: GeoPvN/winstone
function build_tree($cats, $parent_id)
{
    if (is_array($cats) and count($cats[$parent_id]) > 0) {
        $tree = '<ul>';
        foreach ($cats[$parent_id] as $cat) {
            $tree .= '<li>' . $cat['name'];
            $tree .= build_tree($cats, $cat['id']);
            $tree .= '</li>';
        }
        $tree .= '</ul>';
    } else {
        return null;
    }
    return $tree;
}
コード例 #30
0
function build_tree($source_server_id, $root_dn, &$tree)
{
    $children = get_container_contents($source_server_id, $root_dn);
    if (is_array($children) && count($children) > 0) {
        $tree[$root_dn] = $children;
        foreach ($children as $child_dn) {
            build_tree($source_server_id, $child_dn, $tree);
        }
    }
}