1) { if ($page > 1){ $out['prev_link'] = '' . "\n"; } else { $out['prev_link'] = '' . "\n"; } $pmin = ($page > $adjacents) ? ($page - $adjacents) : 1; $pmin = ($page > $total_pages - 1) ? $pmin - 1 : $pmin; $pmin = ($pmin > 0) ? $pmin : 1; $pmax = ($page < ($total_pages - $adjacents)) ? ($page + $adjacents) : $total_pages; $pmax = ($page > 1) ? $pmax : $pmax + 1; $pmax = ($pmax > $total_pages) ? $total_pages : $pmax; for ($i = $pmin; $i <= $pmax; $i++) { if ($i == $page) { $out['pagination'][] = '' . $i . '' ." \n"; } elseif ($i == 1) { $out['pagination'][] = '' . $i . '' . "\n"; } else { $out['pagination'][] = '' . $i . '' . "\n"; } } if ($page < $total_pages) { $out['next_link'] = '' . "\n"; } else { $out['next_link'] = '' . "\n"; } } else { $out['prev_link'] = '' . "\n"; $out['pagination'][] = '1' ." \n"; $out['next_link'] = '' . "\n"; } return $out; } function prepare_pagination_query_string_front_end() { $output = NULL; $query_string = array(); if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { parse_str($_SERVER['QUERY_STRING'], $query_string); unset($query_string['page']); } if (!empty($query_string)) { $output = http_build_query($query_string, '', '&'); if (!empty($output)) { $output = $output . '&'; } } return $output; } function make_breadcrumbs($data) { $divider = '
 / 
'; $segments = array(); end($data); $last_key = key($data); foreach ($data AS $text=>$link) { $href = ''; if ($link) { $href = 'href="'.$link.'"'; } $active = ''; if ($text==$last_key) { $active = 'active '; } $segment = ''; if ($link) { $segment = ''.$text.''; } else { $segment = '
'.$text.'
'; } array_push($segments, $segment); } $home_link = 'Home
 / 
'; $breadcrumbs = implode($divider, $segments); return $home_link.$breadcrumbs; } ?> 0 and category_id<29 order by category_id "; $categories = $db->fetch_all($q,$v); return $categories; } static function getCategory($db, $categoryid){ $v = array($categoryid); $q = "Select title from nb_categories where category_id=?"; $categories = $db->fetch_one($q,$v); return $categories; } static function getContentByCategory($db, $categoryid){ $v = array($categoryid); $q = "select content from paras p, nb_chapters c, nb_paras_chapters_rel pcr where pcr.para_id=p.para_id and pcr.chapter_id=c.chapter_id and c.number=0 and c.category_id=?"; $content = $db->fetch_all($q,$v); return $content; } static function getChapterByCategory($db, $categoryid){ $v = array($categoryid); $q = "select chapter_id, number, title from nb_chapters where category_id=? and number>0 order by number"; $chapter = $db->fetch_all($q,$v); return $chapter; } static function getChaptersInSection($db, $chapterId){ $v = array($chapterId); $q = "select title from nb_sections where chapter_id=?"; $chapter = $db->fetch_all($q,$v); return $chapter; } static function getChapterDetails($db, $categoryId, $chapterId){ $v = array($categoryId, $chapterId); $q = "select cat.title, chap.title as chap, chap.chapter_id from nb_categories cat, nb_chapters chap where (cat.category_id=?) and (chap.category_id=cat.category_id) and (chap.number=?)"; $chapterDetails = $db->fetch_one($q,$v); return $chapterDetails; } static function getParas($db, $categoryId, $chapterId){ $v = array($chapterId, $categoryId); $q = "select p.para_id, p.content, pcr.para_number as number, s.section_id, s.title from paras p, nb_paras_chapters_rel pcr, nb_sections s, nb_chapters ch, nb_categories ca where (p.para_id=pcr.para_id) and (pcr.chapter_id=ch.chapter_id) and (ch.number=?) and (ch.category_id=ca.category_id) and (ca.category_id=?) and (s.section_id=pcr.section_id) order by pcr.para_number"; $para = $db->fetch_all($q,$v); return $para; } static function getParaId($db, $para, $categoryId, $chapterId){ $v = array($categoryId, $para, $chapterId ); $q = "select p.para_id from paras p, nb_chapters ch, nb_categories ca, nb_paras_chapters_rel pcr where (ca.category_id=?) and (ca.category_id=ch.category_id) and (pcr.chapter_id=ch.chapter_id) and (pcr.para_number=?) and (pcr.para_id=p.para_id) and (ch.number=?)"; $para = $db->fetch_one($q,$v); $paraId = !empty($para['para_id']) ? $para['para_id'] : false; return $para; } static function getParaDetails($db, $paraId){ $v = array($paraId); $q = "select para_id, content from paras where para_id=?"; $paraDetails = $db->fetch_one($q,$v); return $paraDetails; } static function getParaBreadcrumbs($db, $paraId){ $v = array($paraId); $q = "select cat.category_id as cat, cat.title as cat_title, chap.number as chap, chap.title as chap_title, pcr.para_number from nb_categories cat, nb_chapters chap, nb_paras_chapters_rel pcr where pcr.para_id= ? and pcr.chapter_id=chap.chapter_id and chap.category_id=cat.category_id"; $paraBreadcrumbs = $db->fetch_one($q,$v); return $paraBreadcrumbs; } static function getParaPerspectives($db, $paraId){ $v = array($paraId); $q = "select chap.number as chap, chap.title as chap_title, pcr.para_number from persp_chapters chap, persp_paras_chapters_rel pcr where pcr.para_id= ? and pcr.chapter_id=chap.chapter_id"; $perspectives = $db->fetch_all($q,$v); return $perspectives; } static function getParaCollection($db, $paraId){ $v = array($paraId); $q = "select c.collection_id, c.title from collections c, collections_paras_rel cpr where cpr.collection_id=c.collection_id and cpr.para_id=?"; $collection = $db->fetch_all($q,$v); return $collection; } static function getRelatedUrls($db, $paraId){ $v = array($paraId); $q = "select url_id, url, description from related_urls where para_id=?"; $realatedUrls = $db->fetch_all($q,$v); return $realatedUrls; } static function getPerspectives($db){ $v = array(); $q = "select content from paras p, persp_chapters c, persp_paras_chapters_rel pcr where pcr.chapter_id=c.chapter_id and c.number=0 and pcr.para_id=p.para_id"; $perspectives = $db->fetch_all($q,$v); return $perspectives; } static function getParaPerspChapters($db, $chapterNumber){ $v = array($chapterNumber); $q = "select p.para_id, p.content, pcr.para_number as number from paras p, persp_paras_chapters_rel pcr, persp_chapters ch where (p.para_id=pcr.para_id) and (pcr.chapter_id=ch.chapter_id) and (ch.number=?)"; $perspectives = $db->fetch_all($q,$v); return $perspectives; } static function getPerspChapters($db, $chapterNumber=''){ $v = array(); $q = "select chapter_id, number, title from persp_chapters order by number"; $perspectives = $db->fetch_all($q,$v); return $perspectives; } static function getPerspChaptersByChapter($db, $chapter){ /*$v = array($chapter); $q = "select title from persp_paras where number=?"; $perspectives = $db->fetch_all($q,$v); return $perspectives;*/ $v = array($chapter); $q = "select p.para_id, p.content, pcr.para_number as number from paras p, persp_paras_chapters_rel pcr, persp_chapters ch where (p.para_id=pcr.para_id) and (pcr.chapter_id=ch.chapter_id) and (ch.number=?)"; $perspectives = $db->fetch_all($q,$v); return $perspectives; } static function getSearchResults($db, $query, $v){ //$v = array(); $q = $query; $results = $db->fetch_all($q,$v); return $results; } static function getRandomPara($db){ $v = array(); $q = "select para_id from paras order by rand(now()) limit 1"; $para = $db->fetch_one($q,$v); return $para; } static function getContentPara($db, $paraId){ $v = array($paraId); $q = "select content from paras where para_id=?"; $para = $db->fetch_one($q,$v); return $para; } } ?>
Fatal error: Uncaught Error: Class "ad" not found in /home/users/pbrunton_d1/wordpress/notebooks/chapter.php:9 Stack trace: #0 {main} thrown in /home/users/pbrunton_d1/wordpress/notebooks/chapter.php on line 9