/** * Get last (n) events up to at least last 30 days worth. Data returned is sorted with most recent first. * Maximum is 100 items, per Stripe * * @param int $num_events number of events to retrieve * @param int $offset offset in the event list * @param string $type event type, or * for all * @param string $created either exact UTC timestamp, or associative array with gt, gte, lt, lte and timestamp * for filtering on time (i.e. array('gt' => 1000) would be all records later than 1000 UTC timestamp * @return array - function returns associative array from stripe, we cant get objects */ public function get_all($num_events = 100, $offset = 0, $type = '*', $created = FALSE) { try { $ch = Stripe_Event::all(array('count' => $num_events, 'offset' => $offset, 'type' => $type, 'created' => $created ? $created : array('gt' => 0))); return $ch; } catch (Exception $e) { $this->error = TRUE; $this->message = $e->getMessage(); $this->code = $e->getCode(); return FALSE; } }
public function index() { // when ACL is ready //$this->checkAccess( __CLASS__, __FUNCTION__ ); //TODO we sync the objects into the collections than we filter and search through them like normal $events = \Stripe_Event::all(); foreach ($events['data'] as $event) { //$data = array_filter((array)$event->data->object); $item = $this->getModel(); $item->set('event.id', $event->id); $item->set('event.created', $event->created); $item->set('event.type', $event->type); //$item->set('data', $cleaned); $item->save(); } $model = $this->getModel(); $state = $model->populateState()->getState(); $this->app->set('state', $state); $paginated = $model->paginate(); $this->app->set('paginated', $paginated); /*$categories_db = (array) $this->getModel( "categories" )->getItems(); $categories = array( array( 'text' => 'All Categories', 'value' => ' ' ), array( 'text' => '- Uncategorized -', 'value' => '--' ), ); array_walk( $categories_db, function($cat) use(&$categories) { $categories []= array( 'text' => $cat->title, 'value' => (string)$cat->slug, ); } ); $this->app->set('categories', $categories ); */ /* $all_tags = array( array( 'text' => 'All Tags', 'value' => ' ' ), array( 'text' => '- Untagged -', 'value' => '--' ), ); $tags = (array) $this->getModel()->getTags(); array_walk( $tags, function($tag) use(&$all_tags) { $all_tags []= array( 'text' => $tag, 'value' => $tag ); } ); $this->app->set('all_tags', $all_tags ); */ $this->app->set('meta.title', 'Events'); $view = \Dsc\System::instance()->get('theme'); echo $view->render('Striper/Admin/Views::events/list.php'); }