Пример #1
0
$req_search_string = $_POST['search_string'];

$display_mode = 'categories';

if(isset($_GET['index'])) {
    $display_mode = "titles";
} else if (isset($_GET['all']) || isset($_GET['latest']) || $req_note_id != "" || $req_cat_id != "" || $req_search_string != "") {
    $display_mode = "contents";
}

$page_title = $title_faq;

if($display_mode == 'categories') {
    $notes = Note::AllNotesIncludingOnesWithoutCategory();
} else if($req_note_id != 0) {
    $notes = Note::NotesWithId($req_note_id);
    if(count($notes) > 0) {
        $n = $notes[0];
        $page_title .= " > ".$n->category_name." > ".$n->title;
    }
} else if($req_cat_id != 0) {
    $c = Category::CategoryWithId($req_cat_id);
    $page_title .= " > ".$c->name;
    $notes = Note::NotesWithCatId($c->id);
} else if($req_search_string != '') {
    $notes = Note::NotesWithSearchString($req_search_string);
} else if (isset($_GET['latest'])) {
    $notes = Note::LatestNotes();
} else {
    $notes = Note::AllNotesIncludingOnesWithoutCategory();
}
Пример #2
0
 public static function NoteWithId($id) {
     $notes = Note::NotesWithId($id);
     
     $n = $notes[0];
     
     if($n) return $n;
     
     return Note::NoteWithIdNoCategory($id);
 }