function display_children($Parent, $Level, &$BOMTree) { global $db; global $i; // retrive all children of parent $c_result = DB_query("SELECT parent,\n\t\t\t\t\t\t\t\tcomponent\n\t\t\t\t\t\tFROM bom WHERE parent='" . $Parent . "'\n\t\t\t\t\t\tORDER BY sequence", $db); if (DB_num_rows($c_result) > 0) { while ($row = DB_fetch_array($c_result)) { if ($Parent != $row['component']) { // indent and display the title of this child $BOMTree[$i]['Level'] = $Level; // Level if ($Level > 15) { prnMsg(_('A maximum of 15 levels of bill of materials only can be displayed'), 'error'); exit; } $BOMTree[$i]['Parent'] = $Parent; // Assemble $BOMTree[$i]['Component'] = $row['component']; // Component // call this function again to display this // child's children $i++; display_children($row['component'], $Level + 1, $BOMTree); } } } }
function display_children($parent, $level, $mode = 2) { $CI =& get_instance(); $current = $CI->uri->segment(1); $result = $CI->db->query("SELECT a.id, a.name, a.target, Deriv1.Count, a.id_module as mode FROM `app_menu` a LEFT OUTER JOIN (SELECT id_parent, COUNT(*) AS Count FROM `app_menu` GROUP BY id_parent) Deriv1 ON a.id = Deriv1.id_parent WHERE a.id_parent=" . $parent . " and a.id_module=" . $mode)->result_array(); $dropdown = $level > 0 ? "class=\"dropdown-menu\"" : "class=\"nav navbar-nav\""; echo "<ul {$dropdown}>"; foreach ($result as $row) { $active = $current === $row['target'] ? "class=\"active\"" : NULL; if ($row['Count'] > 0) { echo "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">" . $row['name'] . " <span class=\"caret\"></span></a>"; display_children($row['id'], $level + 1, $row['mode']); echo "</li>"; } elseif ($row['Count'] == 0) { echo "<li {$active}><a href='" . site_url($row['target']) . "'>" . $row['name'] . "</a></li>"; } else { } } echo "</ul>"; }
function display_children($parent, $level, $id) { $dbc = mysqli_connect("localhost", "root", "root", "mca") or die("Error:.." . mysqli_connect_error); $result = mysqli_query($dbc, "SELECT a.id, a.title, a.body, a.path, Deriv1.Count FROM sidebar a LEFT OUTER JOIN (SELECT parent_id, COUNT( * ) AS Count FROM sidebar GROUP BY parent_id)Deriv1 ON a.id = Deriv1.parent_id WHERE a.parent_id =" . $parent . "") or die('Invalid query: ' . mysql_error()); echo "<ul " . $id . " class='nav nav-sidebar'>"; while ($row = $result->fetch_assoc()) { if ($row['Count'] > 0) { echo "<li><a href='#' class='side-btn' myAttr='" . $row['path'] . "'>" . $row['title'] . "</a>"; display_children($row['id'], $level + 1, " "); echo "</li>"; } elseif ($row['Count'] == 0 || $row['Count'] == NULL) { if ($row['title'] == "Login") { echo "<li><a href='stud_tech/index.php' >" . $row['title'] . "</a></li>"; } else { echo "<li><a href='#' class='side-btn' myAttr='" . $row['path'] . "'>" . $row['title'] . "</a></li>"; } } else { } } echo "</ul>"; }
* */ require_once '../../config.inc.php'; require_once 'common.php'; testlinkInitPage($db); // file_put_contents('/tmp/REQ.txt',serialize($_REQUEST)); $root_node = isset($_REQUEST['root_node']) ? intval($_REQUEST['root_node']) : null; $node = isset($_REQUEST['node']) ? intval($_REQUEST['node']) : $root_node; $filter_node = isset($_REQUEST['filter_node']) ? intval($_REQUEST['filter_node']) : null; $show_tcases = isset($_REQUEST['show_tcases']) ? intval($_REQUEST['show_tcases']) : 1; $tcprefix = isset($_REQUEST['tcprefix']) ? $_REQUEST['tcprefix'] : ''; $operation = isset($_REQUEST['operation']) ? $_REQUEST['operation'] : 'manage'; $helpText = array(); $helpText['testproject'] = isset($_REQUEST['tprojectHelp']) ? $_REQUEST['tprojectHelp'] : ''; $helpText['testsuite'] = isset($_REQUEST['tsuiteHelp']) ? $_REQUEST['tsuiteHelp'] : ''; $nodes = display_children($db, $root_node, $node, $filter_node, $tcprefix, $show_tcases, $operation, $helpText); echo json_encode($nodes); /** * * */ function display_children($dbHandler, $root_node, $parent, $filter_node, $tcprefix, $show_tcases = 1, $operation = 'manage', $helpText = array()) { static $showTestCaseID; $tables = tlObjectWithDB::getDBTables(array('tcversions', 'nodes_hierarchy', 'node_types')); $forbidden_parent = array('testproject' => 'none', 'testcase' => 'testproject', 'testsuite' => 'none'); $external = ''; $nodes = null; $filter_node_type = $show_tcases ? '' : ",'testcase'"; switch ($operation) { case 'print':
* * This tree is used to navigate ... * * @internal revision * */ require_once '../../config.inc.php'; require_once 'common.php'; testlinkInitPage($db); $root_node = isset($_REQUEST['root_node']) ? intval($_REQUEST['root_node']) : null; $node = isset($_REQUEST['node']) ? intval($_REQUEST['node']) : $root_node; $filter_node = isset($_REQUEST['filter_node']) ? intval($_REQUEST['filter_node']) : null; $show_children = isset($_REQUEST['show_children']) ? intval($_REQUEST['show_children']) : 1; $operation = isset($_REQUEST['operation']) ? $_REQUEST['operation'] : 'manage'; $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'reqspec'; $nodes = display_children($db, $root_node, $node, $filter_node, $show_children, $operation, $mode); echo json_encode($nodes); /* */ function display_children($dbHandler, $root_node, $parent, $filter_node, $show_children = ON, $operation = 'manage', $mode = 'reqspec') { $tables = tlObjectWithDB::getDBTables(array('requirements', 'nodes_hierarchy', 'node_types', 'req_specs')); $cfg = config_get('req_cfg'); $forbidden_parent['testproject'] = 'none'; $forbidden_parent['requirement'] = 'testproject'; $forbidden_parent['requirement_spec'] = 'requirement_spec'; if ($cfg->child_requirements_mgmt) { $forbidden_parent['requirement_spec'] = 'none'; } $fn = array(); $fn['print']['reqspec'] = array('testproject' => 'TPROJECT_PTP_RS', 'requirement_spec' => 'TPROJECT_PRS', 'requirement' => 'openLinkedReqWindow');
function getMenu($parent, $level) { $result = mysql_query("SELECT a.id,a.title,a.template,a.url, a.type,a.body, a.slug, Deriv1.Count FROM `menu` a LEFT JOIN (SELECT parent_id, COUNT(*) AS Count FROM `menu` GROUP BY parent_id) Deriv1 ON a.id = Deriv1.parent_id WHERE a.parent_id=" . $parent); while ($row = mysql_fetch_assoc($result)) { $link = $row['type'] == '0' ? site_url($row['url']) : site_url('home/' . $row['slug']); // echo $link; echo '<ul class="nav border-right-1 border-bottom-1 text-nav" >'; if ($row['Count'] > 0) { echo "<li class='dropdown'>\n <a href='#' class='dropdown-toggle' data-toggle='dropdown'>" . $row['title'] . "<b class='caret'></b></a>\n <ul class='dropdown-menu'><li>" . anchor($link, $row['title']) . display_children($row['id'], $level + 1); "</li></ul></li>"; } elseif ($row['Count'] == 0) { echo "<li>" . anchor($link, $row['title'], array('class' => 'level')) . "</li>"; } else { } echo "</ul>"; } }
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="<?php echo site_url(); ?> ">Brand</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <?php display_children(0, 0, isset($menu_mode) ? $menu_mode : 2); ?> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> </div> <div class="row"> <?php getBreadcrumbs(isset($breadActive) ? $breadActive : NULL); ?> </div> <div class="row"> <?php if (isset($main_view)) { if (file_exists(APPPATH . "views/" . $main_view . ".php")) { $this->load->view($main_view);