예제 #1
0
function public_navigation($sel_subject, $sel_page, $public = true)
{
    $output = '<ul class="subjects">';
    $subject_set = get_all_subjects($public);
    while ($subject = mysql_fetch_array($subject_set)) {
        $output .= "<li";
        if ($subject["id"] == $sel_subject['id']) {
            $output .= " class=\"selected\"";
        }
        $output .= "><a href=\"index.php?subj=" . urlencode($subject["id"]) . "\">{$subject["menu_name"]}</a></li>";
        if ($subject["id"] == $sel_subject['id']) {
            $page_set = get_pages_for_subject($subject["id"], $public);
            $output .= "<ul class=\\pages\">";
            while ($page = mysql_fetch_array($page_set)) {
                $output .= "<li";
                if ($page["id"] == $sel_page['id']) {
                    $output .= " class=\"selected\"";
                }
                $output .= "><a href=\"index.php?page=" . urlencode($page["id"]) . "\">{$page["menu_name"]}</a></li>";
            }
            $output .= "</ul>";
        }
    }
    $output .= "</ul>";
    return $output;
}
예제 #2
0
}
?>
 /> Yes
					</p>
					<input type="submit" name="submit" value="Edit Subject" />
					<a href="delete_subject.php?subj=<?php 
echo urlencode($sel_subject['id']);
?>
">Delete</a>
			<br />
			<a href="content.php">Cancel</a>
			<hr />
			<h3>Pages in this subject:</h3>
			<ul>
				<?php 
$page_set = get_pages_for_subject($sel_subject['id']);
if (!empty($page_set)) {
    while ($page = mysql_fetch_array($page_set)) {
        echo "<li><a href=\"content.php?page=" . urlencode($page["id"]) . "\">{$page["menu_name"]}</a></li>";
    }
} else {
    echo "<li>There are no pages in this subject</li>";
}
?>
			</ul>
			<a href="new_page.php?subj=<?php 
echo $sel_subject['id'];
?>
">+ Add a new page</a>
		</td>
	</tr>
 /> Yes
				</p>
				<input type="submit" name="submit" value="Edit Subject" />
				&nbsp;&nbsp;
				<a href="delete_subject.php?subj=<?php 
echo urlencode($sel_subject['id']);
?>
" onclick="return confirm('Are you sure?');">Delete Subject</a>
			</form>
			<br />
			<a href="content.php">Cancel</a>
			<div style="margin-top: 2em; border-top: 1px solid #000000;">
				<h3>Pages in this subject:</h3>
				<ul>
<?php 
$subject_pages = get_pages_for_subject($sel_subject['id']);
while ($page = mysql_fetch_array($subject_pages)) {
    echo "<li><a href=\"content.php?page={$page['id']}\">\n\t\t{$page['menu_name']}</a></li>";
}
?>
				</ul>
				<br />
				+ <a href="new_page.php?subj=<?php 
echo $sel_subject['id'];
?>
">Add a new page to this subject</a>
			</div>
		</td>
	</tr>
</table>
<?php