/** * Paginate data to send to views * * @access public * @static * @param string $model Name of the model to be queried, upppercase * @param array $data Array of keys to be queried * @param array $options * [method] = Name of the method to be applied to the array of keys. Must have variables for $start and $end. Defaults to Message::getMany * @return array $data */ public static function make($model, $data, $options = array()) { if (!isset($options['method'])) { $method = 'getMany'; } else { $method = $options['method']; } $ci =& get_instance(); $count = count($data); if ($count > self::$end) { self::$showNext = true; } if (self::$end - self::$offset > 0) { self::$showPrevious = true; } $return = $ci->{$model}->{$method}($data, self::$start, self::$end, $options); if (empty($return) and self::$page > 1) { $ci->show404(); unset($ci); } else { unset($ci); return $return; } }