function createTree($array, $curParent, $currLevel = 0, $prevLevel = -1) { foreach ($array as $key => $category) { if ($curParent == $category->parent_category_id) { if ($category->parent_category_id == 0) { $class = "dropdown"; } else { $class = "sub_menu"; } if ($currLevel > $prevLevel) { echo " <ul class='{$class}'> "; } if ($currLevel == $prevLevel) { echo " </li> "; } echo "<li data-jstree='{ \"opened\" : true }'><a href='/admin/edit-category/{$category->category_id} '> {$category->category_name}</a>"; if ($currLevel > $prevLevel) { $prevLevel = $currLevel; } $currLevel++; createTree($array, $category->category_id, $currLevel, $prevLevel); $currLevel--; } } if ($currLevel == $prevLevel) { echo " </li> </ul> "; } }
function intShowInterfaceInfo(&$smarty, $interface_name) { $tree = createTree($smarty, $interface_name); $smarty->assign_by_ref("tree", $tree); intSetInterfaceInfo($smarty, $interface_name); $smarty->display("admin/bw/interface_info.tpl"); }
function createTree($array, $curParent, $currLevel = 0, $prevLevel = -1) { foreach ($array as $key => $category) { if ($curParent == $category->parent_category_id) { if ($category->parent_category_id == 0) { $class = "dropdown"; } else { $class = "sub_menu"; } if ($currLevel > $prevLevel) { echo " <ul class='{$class}'> "; } if ($currLevel == $prevLevel) { echo " </li> "; } if (\Illuminate\Support\Facades\Session::get('fs_supplier')['id'] == $category->created_by) { echo "<li data-jstree='{ \"selected\" : true,\"opened\" : true,\"icon\":\"fa fa-edit icon-state-success \" }'><a href='/supplier/edit-category/{$category->category_id} '> {$category->category_name}</a>"; } else { echo "<li data-jstree='{ \"disabled\" : true}'><a data-toggle='tooltip' title='You can edit your category only.' href='javascript:void(0);'> {$category->category_name}</a>"; } if ($currLevel > $prevLevel) { $prevLevel = $currLevel; } $currLevel++; createTree($array, $category->category_id, $currLevel, $prevLevel); $currLevel--; } } if ($currLevel == $prevLevel) { echo " </li> </ul> "; } }
function createTree($array, $curParent, $currLevel = 0, $prevLevel = -1) { foreach ($array as $key => $category) { if ($curParent == $category['parent_id']) { if ($category['parent_id'] == 0) { $class = "dropdown"; } else { $class = "sub_menu"; } if ($currLevel > $prevLevel) { echo " <ul class='{$class}'> "; } if ($currLevel == $prevLevel) { echo " </li> "; } if ($category['group_flag'] == 1) { echo "<li data-jstree='{ \"opened\" : true }'><a href='/admin/edit-feature-group/" . $category['feature_id'] . "'>" . $category['feature_name'] . "</a>"; } else { echo "<li data-jstree='{ \"opened\" : true }'><a href='/admin/edit-feature/" . $category['feature_id'] . "'>" . $category['feature_name'] . "</a>"; } if ($currLevel > $prevLevel) { $prevLevel = $currLevel; } $currLevel++; createTree($array, $category['feature_id'], $currLevel, $prevLevel); $currLevel--; } } if ($currLevel == $prevLevel) { echo " </li> </ul> "; } }
function createTree($category, $left = 0, $right = null) { $tree = array(); foreach ($category as $cat => $range) { if ($range['left'] == $left + 1 && (is_null($right) || $range['right'] < $right)) { $tree[$cat] = createTree($category, $range['left'], $range['right']); $left = $range['right']; } } return $tree; }
function createTree($dir) { $glob = glob($dir . '/*'); $nodes = array(); foreach ($glob as $path) { if (is_dir($path)) { $nodes[basename($path)] = createTree($path); } else { $nodes[basename($path)] = null; } } return $nodes; }
function createTree($data = array(), $parent = 0) { $tree = array(); foreach ($data as $index => $value) { if ($value['parent'] == $parent) { $children = createTree($data, $value['tbid']); if (!empty($children)) { $value['children'] = $children; } $tree[] = $value; } } return $tree; }
function createTree($array, $currentParent, $currLevel = 0, $prevLevel = -2) { foreach ($array as $categoryId => $category) { if ($currentParent == $category['parent_id']) { if ($currLevel > $prevLevel) { echo " <ul> "; } if ($currLevel == $prevLevel) { echo "</li> "; } switch ($category['link']) { case "#": $link = "#"; break; case strpos($category['link'], 'html') !== false: $link = $category['link']; break; case strpos($category['link'], 'html') !== false: $link = $link = LANG . '-' . $category['lien']; } if ($category['link'] == '#') { $link = '#'; } else { if ($category['link'] == '1') { $link = $category['lien']; } else { if ($category['link'] == '2') { $link = LANG . '-' . $category['lien']; } else { $link = LANG . '-page-' . $category['leid'] . '-' . fl($category['name']) . '.html'; } } } echo '<li> <a href="' . $link . '">' . $category['name'] . '</a>'; if ($currLevel > $prevLevel) { $prevLevel = $currLevel; } $currLevel++; createTree($array, $categoryId, $currLevel, $prevLevel); $currLevel--; } } if ($currLevel == $prevLevel) { echo "</li> </ul> "; } }
function createTree($array, $currentParent, $currLevel = 0, $prevLevel = -1) { foreach ($array as $categoryId => $category) { if ($currentParent == $category['parent_ID']) { /*echo "<li> <label for='folder2'>Folder 2</label> <input type='checkbox' id='folder2' /> <ol> <li class='file'><a href=''>File 1</a></li> <li> <label for='subfolder2'>Subfolder 1</label> <input type='checkbox' id='subfolder2' /> <ol> <li class='file'><a href=''>Subfile 1</a></li> <li class='file'><a href=''>Subfile 2</a></li> <li class='file'><a href=''>Subfile 3</a></li> <li class='file'><a href=''>Subfile 4</a></li> <li class='file'><a href=''>Subfile 5</a></li> <li class='file'><a href=''>Subfile 6</a></li> </ol> </li> </ol> </li>";*/ if ($currLevel > $prevLevel) { echo " <ol class='tree'> "; } if ($currLevel == $prevLevel) { echo " </li> "; } echo '<li> <label for="subfolder2">' . $category['topic_title'] . '</label>'; if ($currLevel > $prevLevel) { $prevLevel = $currLevel; } $currLevel++; createTree($array, $categoryId, $currLevel, $prevLevel); $currLevel--; } } if ($currLevel == $prevLevel) { echo " </li> </ol> "; } }
function createTree($node, $arr) { /** Creates a tree containing its children nodes **/ //echo sizeof($arr); for ($i = 0; $i < sizeof($arr); $i++) { if ($arr[$i]['parent'] == $node->id) { $newNode = new stdClass(); $newNode->id = $arr[$i]['id']; $newNode->parent = $arr[$i]['parent']; $newNode->textNoMask = $arr[$i]['nome']; $newNode->text = $arr[$i]['mask'] . " - " . $arr[$i]['nome']; //$newNode->leaf = false; $newNode->mask = $arr[$i]['mask']; $newNode->contacontabil = $arr[$i]['contacontabil']; $newNode->inativo = $arr[$i]['inativo']; $newNode->tipo = $arr[$i]['tipo']; $newNode->natureza = $arr[$i]['natureza']; $newNode->children = array(); $node->children[] = $newNode; createTree($newNode, $arr); } } }
function createTree($id, $sel, $array, $currentParent, $currLevel = 0, $prevLevel = -1) { foreach ($array as $categoryId => $category) { if ($currentParent == $category['parent_id']) { /*echo "<li> <label for='folder2'>Folder 2</label> <input type='checkbox' id='folder2' /> <ol> <li class='file'><a href=''>File 1</a></li> <li> <label for='subfolder2'>Subfolder 1</label> <input type='checkbox' id='subfolder2' /> <ol> <li class='file'><a href=''>Subfile 1</a></li> <li class='file'><a href=''>Subfile 2</a></li> <li class='file'><a href=''>Subfile 3</a></li> <li class='file'><a href=''>Subfile 4</a></li> <li class='file'><a href=''>Subfile 5</a></li> <li class='file'><a href=''>Subfile 6</a></li> </ol> </li> </ol> </li>";*/ if ($currLevel > $prevLevel) { echo " <ol class='tree'>"; } if ($currLevel == $prevLevel) { echo "</li> "; } $checked = ''; if (in_array($category['details']['move_id'], $sel)) { $checked = 'checked'; } $moveSideString = ''; if ($category['details']['move_side'] === 'W') { $moveSideString .= $category['details']['move_number'] . '. '; } echo '<li> <label for="subfolder2">' . $moveSideString . '<a href="' . HTTPPATH . '/chess/repertorie/detail?id=' . $id . '&move_id=' . $category['details']['move_id'] . '&parent_id=' . $category['details']['move_id'] . '" style="text-decoration:none;color:white;">' . $category['name'] . '</a></label> <input type="checkbox" id="subfolder2" ' . $checked . ' />'; if ($currLevel > $prevLevel) { $prevLevel = $currLevel; } $currLevel++; createTree($id, $sel, $array, $categoryId, $currLevel, $prevLevel); $currLevel--; } } if ($currLevel == $prevLevel) { echo " </li></ol>"; } }
<div class="last_activities nano"> <div class="content"> <p class="title">User's Arborescance</p> <?php while ($data_array = $data['friends']['user']['activities']->fetch()) { $bddBranches[$data_array['id']]['id'] = $data_array['id']; $bddBranches[$data_array['id']]['label'] = $data_array['name']; $bddBranches[$data_array['id']]['parent_id'] = $data_array['id_parent_slice']; } if (isset($bddBranches)) { $userTree = createTree($bddBranches); ?> <div id="list_tree">'; <!-- BUILD JSON TREE --> <script> var userTree = <?php echo json_encode($userTree); ?> ; $(function() { $('#list_tree').tree({ data: userTree, }); }); </script>
function createTree(&$list, $parent) { $tree = array(); if ($parent) { if (is_array($parent) && count($parent) > 0) { foreach ($parent as $k => $l) { if (isset($list[$l['id_status_job']])) { $l['children'] = createTree($list, $list[explode("#", $l['id_status_job'])[1]]); } $tree[] = $l; } } } return $tree; }
function createTree($node, $ischild = true) { ?> <div class="tree-node" id="node_<?php echo $node->id; ?> "> <?php if ($ischild) { ?> <div class="tree-connect-hr"></div> <?php } ?> <div class="node-detail"> <div class="name"><?php echo $node->name; ?> </div> <div class="desc"><?php echo $node->desc; ?> </div> </div> <div class="children"> <?php if (!empty($node->children)) { ?> <div class="tree-connect-hr"></div> <div class="tree-connect"></div> <?php foreach ($node->children as $d) { createTree($d); } } ?> </div> </div> <?php }
public function refreshtree($params = NULL) { $data['research'] = $params['0']; $data['marble']['objet_id'] = $this->load->model('marble', 'searchByMetaphone', $data); $data['marble']['mytree'] = $this->load->model('marble', 'mytree', $data); $this->load->script('php', 'tree/makeatree'); while ($data_array = $data['marble']['mytree']->fetch()) { $bddBranches[$data_array['id']]['id'] = $data_array['id']; $bddBranches[$data_array['id']]['label'] = $data_array['name']; $bddBranches[$data_array['id']]['parent_id'] = $data_array['id_parent_slice']; } $data['marble']['mytree']->closeCursor(); $userTree = createTree($bddBranches); echo ' <script> userTree = ' . json_encode($userTree) . '; objnew[0].jsonTree = userTree; $( "#list_tree" ).unbind(); $(function() { $(\'#list_tree\').tree({ data: userTree, dragAndDrop: true, }); }); </script> '; }
$tmp = array(); $string = '<a href="' . HTTPPATH . '/chess/repertorie/' . $pageUrl . '?id=' . $_GET['id'] . '" class="acustom">Pgn</a>: '; foreach ($arrSelectedDetails as $k => $v) { if ($v['details']['move_side'] === 'W') { $string .= $v['details']['move_number'] . '.'; } $string .= ' <a href="' . HTTPPATH . '/chess/repertorie/' . $pageUrl . '?id=' . $_GET['id'] . '&move_id=' . $v['details']['move_id'] . '&parent_id=' . $v['details']['move_id'] . '" class="acustom">' . $v['details']['move'] . '</a> </i>'; } $string .= '<br><br>'; echo $string; } ?> <div class="general-style1"> <?php createTree($_GET['id'], $arrSelectedBox, $arrayCategories, 0); ?> </div> <?php } ?> <h3>Search Fen</h3> <form name="formFen" id="formFen" method="get" action=""> <input type="hidden" name="id" value="<?php echo $_GET['id']; ?> " /> <input type="hidden" name="move_id" value="<?php echo $move_id; ?> " />
$check_is_child = new ph_child(); $check_is_child->get_from_hashrange($job_obj->id); if ($check_is_child->id_child_job != "undefined") { $unfinished_job['id_parent_job'] = $check_is_child->id_parent_job; } else { $unfinished_job['id_parent_job'] = false; } } $new = array(); foreach ($unfinished_jobs as $a) { $new[$a['id_parent_job']][] = $a; } $tree = array(); if (count($new) > 0) { $new_keys = array_keys($new); $tree = createTree($new, $new_keys[0]); // changed } function print_node($n) { global $settings; global $this_server_url; echo "<ul style='padding-left:10px;'>"; echo "<a href='" . "{$this_server_url}/get.php?return=output&job=" . $n['id'] . "' target='_new'>" . $n['id'] . "</a>"; echo " "; echo "<a href='#unfinished_" . $n['id'] . "'>"; echo "("; echo getTranslation("view", $settings); echo ")"; echo "</a>"; echo "(";