/**
  * Simple Get Account Call for testing that the settings are correct.
  * $dev_id and $client_id must be passed to the function.
  */
 public function test_account($dev_id, $client_id)
 {
     $account_info = new \BrownPaperTickets\APIv2\AccountInfo($dev_id);
     $event_list = new \BrownPaperTickets\APIv2\EventInfo($dev_id);
     $response = array('account' => $account_info->getAccount($client_id), 'events' => $event_list->getEvents($client_id));
     $response['events'] = Utilities::remove_bad_events($response['events']);
     return $response;
 }
 public function get_events($client_id = null, $event_id = null)
 {
     if (!$client_id) {
         $client_id = $this->client_id;
     }
     if (!$event_id) {
         $event_id = null;
     }
     /**
      * Get Event List Setting Options
      *
      */
     $show_dates = get_option('_bpt_show_dates');
     $show_prices = get_option('_bpt_show_prices');
     $show_past_dates = get_option('_bpt_show_past_dates');
     $show_sold_out_dates = get_option('_bpt_show_sold_out_dates');
     $show_sold_out_prices = get_option('_bpt_show_sold_out_prices');
     $event_info = new \BrownPaperTickets\APIv2\EventInfo($this->dev_id);
     if ($event_id) {
         $client_id = null;
         $event_id = explode(' ', $event_id);
         $events = array();
         foreach ($event_id as $id) {
             $events[] = $event_info->getEvents($client_id, $id, $show_dates, $show_prices);
         }
         foreach ($events as $event) {
             $event_list[] = $event[0];
         }
     }
     if (!$event_id) {
         $event_list = $event_info->getEvents($client_id, $event_id, $show_dates, $show_prices);
     }
     if (isset($event_list['error'])) {
         $event_list;
     }
     $event_list = Utilities::remove_bad_events($event_list);
     $event_list = Utilities::sort_prices($event_list);
     if ($show_dates === 'true') {
         $remove_past = true;
         if ($show_past_dates === 'false') {
             $remove_past = false;
         }
         $event_list = Utilities::remove_bad_dates($event_list, true, $remove_past);
     }
     if ($show_prices === 'true' && $show_sold_out_prices === 'false') {
         $event_list = Utilities::remove_bad_prices($event_list);
     }
     return $event_list;
 }
예제 #3
0
  * If the query is empty, render the index.html template.
  * The templates are in src/templates.
  */
 if (!$query || !isset($query['client']) && !isset($query['events'])) {
     return $this->view->render($res, 'orders/index.html');
 }
 /**
  * If the client variable is set but not the events, we need to go out and get the events to display.
  */
 if (isset($query['client']) && !isset($query['events'])) {
     /**
      * The EventInfo class is what we use to get event data. To instantiate, you need to pass in a Developer ID.
      * Here, we'll use the DEV_ID constant set in the config/config.php.
      * @var BrownPaperTickets
      */
     $api = new BrownPaperTickets\APIv2\EventInfo(DEV_ID);
     /**
      * The getEvents method takes a few examples. The first and most important is the Client ID.
      * The second param is the event ID, it's optional.
      *
      * The third param would be whether or not you want to get the event's dates.
      * It's a boolean and by default its set to false.
      *
      * The fourth param is whether or not you want to get the prices for each of the event's dates.
      * It's a boolean and by default its set to fasle.
      *
      * Since we don't need the event's dates and prices, we'll just pass in the client.
      */
     $events = $api->getEvents($query['client']);
     /**
      * Now we'll render the template and pass some data along to it.
예제 #4
0
     $table->boolean('live');
     $table->integer('order');
     $table->float('venueFee');
 });
 /**
  * Load the events.json file and store it as the events variable.
  * file_get_contents returns a falsey value if the file does not exist or
  * is empty. It returns FALSE if the file doesn't exist (and throw a warning),
  * or an empty string.
  */
 $events = json_decode(file_get_contents(ROOT_DIR . '/storage/events.json'), true);
 /**
  * Initialize the EventInfo class from the api library.
  * It require a developer ID to be set. You can set that in the config/config.php file.
  */
 $info = new \BrownPaperTickets\APIv2\EventInfo(DEV_ID);
 /**
  * If there aren't any events in the events variable...
  */
 if (!$events) {
     // Load array of producer client logins.
     $producers = (require_once ROOT_DIR . '/config/producers.php');
     // Set the events variable to an empty array.
     $events = [];
     // Loop through each producer login and get their events.
     foreach ($producers as $producer) {
         /**
          * The getEvents method takes a producer client login, an event ID
          * (which is set to null because we don't want a single event)
          * and whether to get the dates (true) and prices (also true).
          */