X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=fs_selfservice%2Ffri%2Fincludes%2Fdisplay.php;fp=fs_selfservice%2Ffri%2Fincludes%2Fdisplay.php;h=41d8dc5f0f6072269dd2d88fbbd2810000df6815;hp=0000000000000000000000000000000000000000;hb=3a17b276638200475d54201fa62566b7440e819a;hpb=46c6025ca0759b96e5bd16e7ce4b16d4df8a0988 diff --git a/fs_selfservice/fri/includes/display.php b/fs_selfservice/fri/includes/display.php new file mode 100644 index 000000000..41d8dc5f0 --- /dev/null +++ b/fs_selfservice/fri/includes/display.php @@ -0,0 +1,222 @@ +" . $text . " +
"; + + return $ret; + } + + /** + * displays header line + */ + function displayLine() { + + $ret = " +
+
+
+
+
"; + + return $ret; + } +} + +/** + * DisplaySearch + */ +class DisplaySearch extends Display { + + /** + * Constructor + */ + function DisplaySearch() { + } + + /** + * displays search controls + * + * @param $align + * where to align the control + * @param $q + * search query + * @param $focus + * whether to focus control on this block + */ + function displaySearchBlock($align,$m,$q,$url_opts,$focus) { + + // align + if ($align=='center') { + $alignText = "class='bar_center'"; + } + else { + $alignText = "class='bar_left'"; + } + + // url options + foreach ($url_opts as $key => $value) { + $option_text .= ""; + } + + // build + $ret .= "
+
+ + + " . $option_text . " + + +
+
"; + + if ($focus=="true") { // search block loaded twice usually so only allow javascript to be loaded on the top block + $ret .= ""; + } + + return $ret; + } + + /** + * displays info bar + * + * @param $controls + * controls for the page on the bar + * @param $q + * search query + * @param $start + * start number of current page + * @param $span + * number of items on current page + * @param $total + * total number of records found by current search + */ + function displayInfoBarBlock($controls,$q,$start,$span,$total) { + + if ($total<$span) { + $span = $total; + } + $start_count = ($total>0)?$start+1:$start; + $span_count = ($start+$span>$total)?$total:$start+$span; + + if ($controls) { + $left_text = $controls; + } + elseif ($q != NULL) { + $left_text = "" . _("Searched for") . " " . $q . ""; + } + + if ($span<$total) { + $right_text = "" . sprintf(_("Results %d - %d of %d"),$start_count,$span_count,$total) . ""; + } else { + $right_text = "" . sprintf(_("Results %d"),$total) . ""; + } + + $ret .= " + + + + + + "; + + return $ret; + } + + /** + * displays navigation bar + * + * @param $q + * search query + * @param $start + * start number of current page + * @param $span + * number of items on current page + * @param $total + * total number of records found by current search + */ + function displayNavigationBlock($m,$q,$url_opts,$start,$span,$total) { + + $start = $start=='' ? 0 : $start ; + $span = $span=='' ? 15 : $span ; + + $total_pages = ceil($total/$span); + $start_page = floor($start/$span); + + // if more than ten pages start at this page minus ten otherwise start at zero + $begin = ($start_page>10)?($start_page-10):0; + // if more than ten pages then stop at this page plus ten otherwise stop at last page + $end = ($start_page>8)?($start_page+10):10; + + // url + $unicode_q = urlencode($q); // encode search string + + foreach ($url_opts as $key => $value) { + $option_text .= "&" . $key . "=" . $value; + } + + $url = $_SESSION['ARI_ROOT'] . "?m=" . $m . "&q=" . $unicode_q . $option_text; + + // build + if ($start_page!=0) { + $start_page_text = "" . _("First") . "  + < "; + } + + for($next_page=$begin;($next_page<$total_pages)&&($next_page<$end);$next_page++) { + if ($next_page == $start_page) { + $middle_page_text .= "" . ($next_page+1) . " "; + } else { + $middle_page_text .= "" . ($next_page+1) . " "; + } + } + if ( ($start_page != $total_pages-1) && ($total != 0) ) { + $end_page_text = ">  + " . _("Last") . " "; + } + + $ret .= "
+ " . $start_page_text . " + " . $middle_page_text . " + " . $end_page_text . " +
"; + + return $ret; + } +} + + +?> \ No newline at end of file