function print_task($R, $level) { global $tasks; if ($R['finished'] == -1) { $finisheddisplay = 0; } else { $finisheddisplay = $R['finished']; } if ($R['finished'] == 100) { $task_finished_class = 'taskFinished'; $finished_class = 'finished'; } else { $task_finished_class = 'taskNotfinished'; $finished_class = 'notfinished'; } if ($R['hidden'] == '1') { $hiddenstatus = 'hidden'; $task_css_style = ' height: 5px; display: list-item; padding: 0px;'; $div_css_style = ' style="display:none;"'; } else { $hiddenstatus = 'nothidden'; $task_css_style = ''; $div_css_style = ''; } if ($R['removed'] == '1') { $removedstatus = 'removed'; } else { $removedstatus = 'notremoved'; } echo ' <li id="task' . $R['id'] . '" style="margin-left: ' . 40 * $level . 'px;' . $task_css_style . '">' . '<div class="sorter"' . $div_css_style . '></div>' . '<div class="finish ' . $finished_class . '"' . $div_css_style . '></div>' . '<div class="level"' . $div_css_style . '>' . $level . '</div>' . '<div class="id_display"' . $div_css_style . '>' . $R['id'] . '</div>' . '<div class="parent_id"' . $div_css_style . '>' . $R['parent'] . '</div>' . '<div class="position"' . $div_css_style . '>' . $R['position'] . '</div>' . '<div class="finisheddisplay"' . $div_css_style . '>' . $finisheddisplay . ' %</div>' . '<div class="finishedvalue">' . $R['finished'] . '</div>' . '<div class="hiddenstatus ' . $hiddenstatus . '">-</div>' . '<div class="removedstatus ' . $removedstatus . '"' . $div_css_style . '>X</div>' . '<div class="task ' . $task_finished_class . '" id="' . $R['id'] . '" contenteditable=""' . $div_css_style . '>' . $R['text'] . '</div>' . '</li>' . chr(10); // Print the children of this task print_children($R['id'], $level); unset($tasks[$R['id']]); }
function print_children($pcid, $pcs, $mi_mother = '0', $mi_disabled = "", $current_mi = '0') { global $DLTL; $sql_p_c = "SELECT * FROM `menu_items` \n\t\t\t\t\tINNER JOIN `menu_items-languages` ON `menu_items`.MI_ID=`menu_items-languages`.MI_ID\n\t\t\t\t\tWHERE `menu_items`.MI_DELETED = 0 AND `menu_items`.MI_MOTHER = '{$pcid}' \n\t\t\t\t\tAND `menu_items-languages`.L_ID = '{$DLTL}' \n\t\t\t\t\tORDER BY `menu_items`.MI_RANK, `menu_items-languages`.MIL_ALIAS"; $query_p_c = mysql_query($sql_p_c); $rows_p_c = mysql_num_rows($query_p_c); if ($rows_p_c) { while ($result_p_c = mysql_fetch_array($query_p_c)) { $mi_selected = ""; if ($result_p_c['MI_ID'] == $mi_mother) { $mi_selected = "SELECTED"; } $i_am_current = false; if ($current_mi == $result_p_c['MI_ID']) { $mi_disabled = "DISABLED"; $i_am_current = true; } echo '<option value="' . $result_p_c['MI_ID'] . '" ' . $mi_selected . ' ' . $mi_disabled . '>' . $pcs . stripslashes($result_p_c['MIL_ALIAS']) . '</option>'; print_children($result_p_c['MI_ID'], $pcs . ' - - - ', $mi_mother, $mi_disabled, $current_mi); if ($i_am_current) { $mi_disabled = ""; } } } }
function print_children($children) { $html = ''; foreach ($children as $child) { $html .= create_list_item($child); if (count($child->wines) > 0) { $html .= '<ul class="vins">' . print_wines($child->wines) . '</ul>'; } if (count($child->children) > 0) { $html .= '<ul>' . print_children($child->children) . '</ul>'; } $html .= '</div>'; } return $html; }
function print_children($children) { $html = ''; foreach ($children as $child) { $html .= create_list_item($child); if (count($child->wines) > 0) { $html .= print_wines($child->wines); } if (count($child->children) > 0) { $html .= print_children($child->children); } $html .= end_table(); } return $html; }
function print_children($id) { $children = query($id); if (!empty($children)) { echo '<ul class="list-unstyled">'; foreach ($children as $child) { $ck = check_cat($_GET['id'], $child['id']); if ($ck) { $ckd = "checked"; } else { $ckd = ""; } echo '<li> <label><input type="checkbox" ' . $ckd . ' name="category[]" value="' . $child['id'] . '">' . $child['name'] . '</label>'; print_children($child['id']); echo '</li>'; } echo '</ul>'; } }
<table class='er_container' id='erc1'> <tbody id='erb_c1'> <?php echo print_subheader("attributes", $editable); ?> <?php echo print_attributes($attributes, $editable); ?> </tbody> </table> <input id='sep' name='sep' type='hidden' value='1'/> <table class='er_container' id='erc2'> <tbody id='erb_c2'> <?php echo print_subheader("rules", $editable); ?> <?php echo print_children($children, $editable); ?> </tbody> </table> <?php echo print_subfooter($params, $editable); ?> </form> </div>
function print_children($id) { $children = query($id); if (!empty($children)) { echo '<ol class="dd-list">'; foreach ($children as $child) { $childdet = get_the_menu($child['id']); echo '<li class="dd-item dd3-item" data-id="' . $child['id'] . '"> <div class="dd-handle dd3-handle"> </div> <div class="dd3-content"> ' . $child['id'] . ". " . $child['name'] . '<i class="fa fa-edit pull-right" onclick=window.location="menu.php?edit=' . $child['id'] . '"></i><i class="fa fa-link pull-right" onclick=window.location="../' . $childdet['desc'] . '"></i> </div>'; print_children($child['id']); echo '</li>'; } echo '</ol>'; } }
} ?> </div> <div class="content"> <?php if (count($category->wines) > 0) { foreach ($category->wines as $region_du_monde) { $allWines[] = $region_du_monde; } echo '<div>'; if (count($category->children) == 0) { echo '<h2>' . $category->label . '</h2>'; } echo '<ul>'; echo print_wines($allWines); echo '</ul>'; echo '</div>'; } foreach ($category->children as $child) { $allChildrens[] = $child; } echo print_children($allChildrens); ?> </div> <div class="clear"></div> </div> <?php } ?> </div> <div class="clear"></div>
<head> <title>HTODO - Hierarchy todo list</title> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script> <link rel="stylesheet" type="text/css" href="css/htodo.css" /> </head> <body> <div id="workingIcon" class="workingIcon"><img width="32" height="32" src="loading.gif"></div> <div id="tester"></div> <ul id="tasks"> <?php $query = mysql_query('select id,\'0\' as parent, text, removed, removed_time, hidden, finished, \'0\' as position from `tasks` where removed = true order by `position`'); $parents = array(); $tasks = array(); while ($R = mysql_fetch_assoc($query)) { if (!isset($parents[$R['parent']])) { $parents[$R['parent']] = array(); } $parents[$R['parent']][] = $R['id']; $tasks[$R['id']] = $R; } print_children(0, 0); // Start at level 1 ?> </ul> <div class="license"><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/no/"><img alt="Creative Commons License" style="border-width:0" src="images/cc-by-sa-80x15.png" /></a> <span xmlns:dc="http://purl.org/dc/elements/1.1/" property="dc:title">HTODO</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://hnygard.no/" property="cc:attributionName" rel="cc:attributionURL">Hallvard Nygård</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/no/">Creative Commons Attribution-Share Alike 3.0 Norway License</a>. Source code can be found at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://github.com/HNygard/HTODO" rel="dc:source">github.com/HNygard/HTODO</a>.</div> </body> </html>
if (!empty($_REQUEST['mi'])) { $current_mi = $_REQUEST['mi']; } ?> <select name="mi_mother" class="long"> <option value="0" SELECTED>Κανένα</option> <optgroup label="Παρακαλώ επιλέξτε"> <?php //Listing the available menu items include "functions.php"; require "db_connect.php"; $sql_mi_mother = "SELECT * FROM `menu_items` \n\t\t\t\t\t\t\tINNER JOIN `menu_items-languages` ON `menu_items`.MI_ID=`menu_items-languages`.MI_ID\n\t\t\t\t\t\t\tINNER JOIN `menu_groups-menu_items` ON `menu_items`.MI_ID=`menu_groups-menu_items`.MI_ID\n\t\t\t\t\t\t\tWHERE `menu_groups-menu_items`.MG_ID = '{$view_mg}' \n\t\t\t\t\t\t\tAND `menu_items`.MI_DELETED = 0 \n\t\t\t\t\t\t\tAND `menu_items-languages`.L_ID = '{$DLTL}' \n\t\t\t\t\t\t\tAND (`menu_items`.MI_MOTHER IS NULL OR `menu_items`.MI_MOTHER = '0') \n\t\t\t\t\t\t\tORDER BY `menu_items`.MI_RANK, `menu_items-languages`.MIL_ALIAS"; $query_mi_mother = mysql_query($sql_mi_mother) or die(mysql_error()); $pcs = ''; //dashes while ($result_mi_mother = mysql_fetch_array($query_mi_mother)) { $mi_selected = ""; if ($result_mi_mother['MI_ID'] == $mi_mother) { $mi_selected = "SELECTED"; } $mi_disabled = ""; if ($current_mi == $result_mi_mother['MI_ID']) { $mi_disabled = "DISABLED"; } echo '<option value="' . $result_mi_mother['MI_ID'] . '" ' . $mi_selected . ' ' . $mi_disabled . '>' . stripslashes($result_mi_mother['MIL_ALIAS']) . '</option>'; print_children($result_mi_mother['MI_ID'], $pcs . ' - - - ', $mi_mother, $mi_disabled, $current_mi); } require "db_disconnect.php"; ?> </optgroup> </select>
function print_children($id) { $children = query($id); if (!empty($children)) { echo '<ol class="dd-list">'; foreach ($children as $child) { echo '<li class="dd-item dd3-item" data-id="' . $child['id'] . '"> <div class="dd-handle dd3-handle"> </div> <div class="dd3-content"> ' . $child['id'] . ". " . $child['name'] . '<i class="fa fa-edit pull-right" onclick=window.location="edit-post-category.php?id=' . $child['id'] . '"></i> </div>'; print_children($child['id']); echo '</li>'; } echo '</ol>'; } }
function print_children($cat, &$buffer) { //return; //for the timebeing no sub categories allowed $buffer .= "\n\n" . '<li class="dd-item dd3-item" data-id="' . $cat->cat_id . '">' . '<div class="dd-handle">' . $cat->cat_alias . '</div><span class="dd-options">' . '<a class="btn btn-default" href="index.php?page=permission/categories&cat_id=' . $cat->cat_id . '"><i class="fa fa-key"></i> Permissions</a> ' . ' <a class="btn btn-default" href="index.php?page=categories&action=edit&cat_id=' . $cat->cat_id . '"><i class="fa fa-edit"></i> Edit</a> ' . ' <a class="btn btn-danger" href="javascript:void(0)" onclick="delete_cat(' . $cat->cat_id . ', \'' . $cat->cat_name . '\');"><i class="fa fa-trash-o"></i></a></span>'; if (property_exists($cat, 'children')) { foreach ($cat->children as $child) { $buffer .= "\n<ol class='dd-list'>"; print_children($child, $buffer); $buffer .= "\n</ol>"; } } else { } $buffer .= "\n</li>"; }