Beispiel #1
1
function find_selected_pages($public = false)
{
    global $current_subject;
    global $current_page;
    if (isset($_GET["subject"])) {
        //use get request to get my subject id
        $selected_subject_id = $_GET["subject"];
        //get my subject details by id from the database
        $current_subject = find_subject_by_id($selected_subject_id, $public);
        $selected_page_id = null;
        if ($current_subject && $public) {
            $current_page = find_default_page_for_subject($current_subject["id"]);
        } else {
            $current_page = null;
        }
    } elseif (isset($_GET["page"])) {
        $selected_subject_id = null;
        $current_subject = null;
        $selected_page_id = $_GET["page"];
        $current_page = find_page_by_id($selected_page_id);
    } else {
        $selected_subject_id = null;
        $current_subject = null;
        $selected_page_id = null;
        $current_page = null;
    }
}
function find_selected_page($public = false)
{
    global $current_subject;
    global $current_page;
    if (isset($_GET["subject"])) {
        $current_subject = find_subject_by_id($_GET["subject"], $public);
        if ($current_subject && $public) {
            $current_page = find_default_page_for_subject($current_subject["id"]);
        } else {
            $current_page = null;
        }
    } elseif (isset($_GET["page"])) {
        $current_page = find_page_by_id($_GET["page"], $public);
        $current_subject = null;
    } else {
        $current_subject = null;
        $current_page = null;
    }
}
function find_selected_page($public = false)
{
    global $current_page;
    global $current_subject;
    if (isset($_GET["subject"])) {
        //  This is an associative array with all the database info
        $current_subject = find_subject_by_id($_GET["subject"], $public);
        if ($current_subject && $public) {
            $current_page = find_default_page_for_subject($current_subject["id"]);
        } else {
            $current_page = null;
        }
    } elseif (isset($_GET["page"])) {
        $current_subject = null;
        $current_page = find_page_by_id($_GET["page"], $public);
    } else {
        $current_page = null;
        $current_subject = null;
    }
}