function paginate($page, $total, $itemsPerPage, $paginationName = 'pagination') { if (empty($page) || !is_numeric($page)) { $page = 1; } $totalPage = ceil($total / $itemsPerPage); $prevPage = $page > 1 ? $page - 1 : ''; $nextPage = $page < $totalPage ? $page + 1 : ''; $pagination = array('page' => $page, 'prevPage' => $prevPage, 'nextPage' => $nextPage, 'total' => $total, 'itemPerPage' => $itemsPerPage, 'totalPage' => $totalPage); Reg::tplSet($paginationName, $pagination); return 'LIMIT ' . ($page - 1) * $itemsPerPage . ', ' . $itemsPerPage; }
public static function requiredData($requiredData) { $data = array(); if (empty($requiredData)) { return $data; } Reg::tplSet('sitesData', self::getSites()); foreach ($requiredData as $action => $args) { if (method_exists('panelRequestManager', $action)) { if ($action == 'getSitesUpdates') { $data[$action] = self::$action($GLOBALS['userID']); } else { $data[$action] = self::$action($args); } } elseif (in_array($action, self::$addonFunctions) && function_exists($action)) { $data[$action] = call_user_func($action, $args); } elseif (strpos($action, '::') !== false && in_array($action, self::$addonFunctions)) { $tempMethod = explode('::', $action); if (method_exists($tempMethod[0], $tempMethod[1])) { $data[$action] = call_user_func($action, $args); } } } return $data; }