function navigation($subject_array, $page_array) { $output = '<ul class="subjects">'; $subject_set = find_all_subjects(); while ($subject = mysqli_fetch_assoc($subject_set)) { $output .= "<li "; if ($subject_array && $subject_array['id'] == $subject['id']) { $output .= "class='selected' "; } $output .= "> "; $output .= "<a href='manage_content.php?subject=" . urlencode($subject['id']) . "'> " . htmlentities($subject['menu_name']) . "</a>"; $pages_set = find_pages_for_subject($subject['id']); $output .= "<ul class='pages'>"; while ($page = mysqli_fetch_assoc($pages_set)) { $output .= "<li "; if ($page_array && $page_array['id'] == $page['id']) { $output .= "class='selected'"; } $output .= "> "; $output .= "<a href='manage_content.php?page=" . urlencode($page['id']) . "'> " . htmlentities($page['menu_name']) . " </a></li> "; } $output .= "</ul>\n </li>"; } mysqli_free_result($subject_set); mysqli_free_result($pages_set); $output .= '</ul>'; return $output; }
function navigation($subject_array, $page_array) { $output = "<ul class=\"subjects\">"; $subject_set = find_all_subjects(); while ($subject = mysqli_fetch_assoc($subject_set)) { $output .= "<li"; if ($subject_array && $subject["id"] == $subject_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"manage_content.php?subject="; $output .= urlencode($subject["id"]); $output .= "\">"; $output .= $subject["menu_name"]; $output .= "</a>"; $page_set = find_pages_for_subject($subject["id"]); $output .= "<ul class=\"pages\">"; while ($page = mysqli_fetch_assoc($page_set)) { $output .= "<li"; if ($page_array && $page["id"] == $page_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"manage_content.php?page="; $output .= urlencode($page["id"]); $output .= "\">"; $output .= $page["menu_name"]; $output .= "</a></li>"; } mysqli_free_result($page_set); $output .= "</ul></li>"; } mysqli_free_result($subject_set); $output .= "</ul>"; return $output; }
?> </h2> <form action="edit_subject.php?subject=<?php echo urlencode($current_subject["id"]); ?> " method="post"> <p>Menu name: <input type="text" name="menu_name" value="<?php echo htmlentities($current_subject["menu_name"]); ?> " /> </p> <p>Position: <select name="position"> <?php $subject_set = find_all_subjects(false); $subject_count = mysqli_num_rows($subject_set); for ($count = 1; $count <= $subject_count; $count++) { echo "<option value=\"{$count}\""; if ($current_subject["position"] == $count) { echo " selected"; } echo ">{$count}</option>"; } ?> </select> </p> <p>Visible: <input type="radio" name="visible" value="0" <?php if ($current_subject["visible"] == 0) { echo "checked";
function public_content_navigation($subject_array, $page_array) { $output = "<ul class=\"subjects\">"; $subject_set = find_all_subjects(); while ($subject = mysqli_fetch_assoc($subject_set)) { $output .= "<li"; if ($subject_array && $subject["id"] == $subject_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?subject="; $output .= urlencode($subject["id"]); $output .= "\">"; $output .= htmlentities($subject["menu_name"]); $output .= "</a>"; if ($subject_array["id"] == $subject["id"] || $page_array["subject_id"] == $subject["id"]) { $page_set = find_pages_for_subject($subject["id"]); $output .= "<ul class=\"pages\">"; while ($page = mysqli_fetch_assoc($page_set)) { $output .= "<li"; if ($page_array && $page["id"] == $page_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?page="; $output .= urlencode($page["id"]); $output .= "\">"; $output .= htmlentities($page["menu_name"]); $output .= "</a></li>"; } $output .= "</ul>"; mysqli_free_result($page_set); } $output .= "</li>"; // end of the subject li } mysqli_free_result($subject_set); $output .= "</ul>"; return $output; }
function public_navigation($subject_array, $page_array) { $output = "<ul class=\"subjects\">"; $subject_set = find_all_subjects(); // 3. Use returned data (if any) while ($subject = mysqli_fetch_assoc($subject_set)) { // output data from each row $output .= "<li"; if ($subject_array && $subject["id"] == $subject_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?subject="; $output .= urlencode($subject["id"]); $output .= "\">"; $output .= htmlentities($subject["menu_name"]); $output .= "</a>"; $page_set = find_pages_for_subject($subject["id"]); $output .= "<ul class=\"pages\">"; // 3. Use returned data (if any) while ($page = mysqli_fetch_assoc($page_set)) { // output data from each row $output .= "<li"; if ($page_array && $page["id"] == $page_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?page="; $output .= urlencode($page["id"]); $output .= "\">"; $output .= htmlentities($page["menu_name"]); $output .= "</a>"; $output .= "</li>"; } mysqli_free_result($page_set); $output .= "</ul>"; $output .= "</li>"; } // 4. Release returned data mysqli_free_result($subject_set); $output .= "</ul>"; return $output; }
?> </h2> <form action="edit_subject.php?subject=<?php echo $current_subject["id"]; ?> " method="post"> <p>Menu name: <input type="text" name="menu_name" value="<?php echo $current_subject["menu_name"]; ?> " /> </p> <p>Position: <select name="position"> <?php $subject_set = find_all_subjects(); $subject_count = mysqli_num_rows($subject_set); for ($count = 1; $count <= $subject_count; $count++) { echo "<option value=\"{$count}\""; if ($current_subject["position"] == $count) { echo " selected"; } echo ">{$count}</option>"; } ?> </select> </p> <p>Visible: <input type="radio" name="visible" value="0" <?php if ($current_subject["visible"] == 0) { echo "checked";
echo $subject_title['menu_name']; ?> </h2> <form action="create_subject.php" method="post"> <p> Subject name: <input type="text" name="menu_name" value="<?php echo $subject_title['menu_name']; ?> "> </p> <p> Position: <select name="position"> <?php $all_subjects = find_all_subjects(); $subject_count = mysqli_num_rows($all_subjects); for ($count = 1; $count <= $subject_count; $count++) { echo "<option value=\"{$count}\""; if ($current_subject["position"] == $count) { echo " selected"; } echo ">{$count}</option>"; } ?> </select> </p> <p> visible: <input type="radio" name="visible" value="0" <?php if ($current_subject["visible"] == 0) {
function public_navigation($subject_array, $page_array) { $output = "<ul class=\"subjects\">"; $subject_set = find_all_subjects(); while ($subject = mysqli_fetch_assoc($subject_set)) { // this php is for only an <li> tag to either have a class of selected // or not but I use the php to output everything including the normal // <li> tag $output .= "<li"; if ($subject_array && $subject["id"] == $subject_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?subject="; $output .= urldecode($subject["id"]); $output .= "\">"; $output .= htmlentities($subject["menu_name"]); $output .= "</a>"; if ($subject_array["id"] == $subject["id"] || $page_array["subject_id"] == $subject["id"]) { $page_set = find_pages_for_subject($subject["id"]); $output .= "<ul class=\"pages\">"; while ($page = mysqli_fetch_assoc($page_set)) { $output .= "<li"; if ($page_array && $page["id"] == $page_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?page="; $output .= urldecode($page["id"]); $output .= "\">"; $output .= htmlentities($page["menu_name"]); $output .= "</a></li>"; } $output .= "</ul>"; mysqli_free_result($page_set); } $output .= "</li>"; // end of subject <li> } mysqli_free_result($subject_set); $output .= "</ul>"; return $output; }
function public_menu($subject_id, $page_id) { global $db; ?> <div id="nav-container"> <ul class="parent-nav nav nav-pills"> <li><a href="http://yodas.brain">Home</a></li> <?php $result = find_all_subjects($public = true); while ($subjects = mysqli_fetch_assoc($result)) { $safe_subject_id = $db->escape_string($subject_id); ?> <li class="dropdown" <?php if ($subject_id && $subjects["id"] == $safe_subject_id) { ?> class="selected" <?php } ?> > <a class="dropdown-toggle" data-toggle="dropdown" href="<?php ROOT_PATH; ?> /index.php?subject=<?php echo urlencode($subjects["id"]); ?> " aria-haspopup="true" aria-expanded="false"><?php echo $subjects["menu_name"]; ?> </a> <?php $page_result = find_subject_pages($subjects["id"]); ?> <ul class="child-nav dropdown-menu"> <?php // 3. Use returned data (if any) while ($pages = mysqli_fetch_assoc($page_result)) { ?> <?php $safe_page_id = $db->escape_string($page_id); ?> <li <?php if ($page_id && $pages["id"] == $safe_page_id) { ?> class="selected" <?php } ?> > <a href="<?php ROOT_PATH; ?> /index.php?page=<?php echo urlencode($pages["id"]); ?> "> <?php echo $pages["menu_name"]; ?> </a> </li> <?php } mysqli_free_result($page_result); ?> </ul> <?php } mysqli_free_result($result); ?> </li> <?php if (logged_in()) { ?> <li><a href="../../admin.php">Admin</a></li> <?php } ?> <?php if (!logged_in()) { ?> <li><a href="../../views/actions/login.php">Login</a></li> <?php } ?> <?php if (logged_in()) { ?> <li><a href="<?php ROOT_PATH; ?> /controller/logout.php">Logout</a></li> <?php } ?> </ul> </div> <?php }
function public_navigation($selected_subject_set, $selected_page_set) { $output = "<ul class=\"nav navbar-nav\">"; $subject_set = find_all_subjects(); while ($subject = $subject_set->fetch_assoc()) { $output .= "<li"; if ($selected_subject_set == $subject['id']) { $output .= " class=\"active\""; } $output .= ">"; $output .= "<a href=\"index.php?subject="; $output .= $subject['id']; $output .= "\">"; $output .= $subject['menu_name']; $output .= "</a>"; $page_set = find_pages_for_subjects($subject['id']); $output .= "<ul class=\"pages\">"; while ($pages = $page_set->fetch_assoc()) { $output .= "<li"; if ($selected_page_set == $pages['id']) { $output .= " class=\"active\""; } $output .= ">"; $output .= "<a href=\"index.php?pages="; $output .= $pages['id']; $output .= "\">"; $output .= $pages['menu_name']; $output .= "</a></li>"; } $output .= "</ul>"; $output .= "</li>"; } $output .= "</ul>"; mysqli_free_result($page_set); mysqli_free_result($subject_set); return $output; }