$v) { if(!is_array($v) && strpos($v,'%') === false) { $table = $table->where($k, $v); }else{ if(is_array($v)){ $table = $table->where_in($k, $v); }else{ $table = $table->where_like($k, $v); } } } $totalReq = $table->count(); $page = ($page == 0 ? 1 : $page); $next = $page + 1; $lastpage = ceil($totalReq / $per_page); $lpm1 = $lastpage - 1; $limit = $per_page; $startpoint = ($page * $limit) - $limit; if ($lastpage >= 1) { $pagination .= '"; return array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination); } } public static function bootstrap($table, $w1 = '', $c1 = '', $w2 = '', $c2 = '', $w3 = '', $c3 = '', $w4 = '', $c4 = '', $per_page = '10') { global $routes; global $_L; $url = U . $routes['0'] . '/' . $routes['1'] . '/'; $adjacents = "2"; $page = (int)(!isset($routes['2']) ? 1 : $routes['2']); $pagination = ""; if(is_object($table)){ if ($w1 != '') { $totalReq = $table->where($w1, $c1)->count(); } elseif ($w2 != '') { $totalReq = $table->where($w1, $c1)->where($w2, $c2)->count(); } elseif ($w3 != '') { $totalReq = $table->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count(); } elseif ($w4 != '') { $totalReq = $table->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count(); } else { $totalReq = $table->count(); } }else{ if ($w1 != '') { $totalReq = ORM::for_table($table)->where($w1, $c1)->count(); } elseif ($w2 != '') { $totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->count(); } elseif ($w3 != '') { $totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count(); } elseif ($w4 != '') { $totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count(); } else { $totalReq = ORM::for_table($table)->count(); } } $i = 0; $page = ($page == 0 ? 1 : $page); $start = ($page - 1) * $per_page; $prev = $page - 1; $next = $page + 1; $lastpage = ceil($totalReq / $per_page); $lpm1 = $lastpage - 1; $limit = $per_page; $startpoint = ($page * $limit) - $limit; if ($lastpage >= 1) { $pagination .= '"; $gen = array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination); return $gen; } } public static function bootstrapRaw($table, $w1 = '', $c1 = [], $per_page = '10') { global $routes; global $_L; $url = U . $routes['0'] . '/' . $routes['1'] . '/'; $adjacents = "2"; $page = (int)(!isset($routes['2']) ? 1 : $routes['2']); $pagination = ""; if(is_object($table)){ if ($w1 != '') { $totalReq = $table->where_raw($w1, $c1)->count(); } else { $totalReq = $table->count(); } }else{ if ($w1 != '') { $totalReq = ORM::for_table($table)->where_raw($w1, $c1)->count(); } else { $totalReq = ORM::for_table($table)->count(); } } $i = 0; $page = ($page == 0 ? 1 : $page); $start = ($page - 1) * $per_page; $prev = $page - 1; $next = $page + 1; $lastpage = ceil($totalReq / $per_page); $lpm1 = $lastpage - 1; $limit = $per_page; $startpoint = ($page * $limit) - $limit; if ($lastpage >= 1) { $pagination .= '"; $gen = array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination); return $gen; } } }