getAvailable() public method

Get the available packages (based on data provided by Keyggdrasil)
public getAvailable ( string $type = '', string $query = '', integer $offset, integer $limit ) : array
$type string
$query string Search query
$offset integer
$limit integer
return array
Example #1
0
 /**
  * @route ajax/admin/skyport/browse
  */
 public function ajaxGetAvailablePackages()
 {
     $post = $_POST ?? [];
     $type = '';
     $headline = 'Available Extensions';
     if (isset($post['type'])) {
         switch ($post['type']) {
             case 'cabin':
                 $headline = 'Available Cabins';
                 $type = 'Cabin';
                 break;
             case 'gadget':
                 $headline = 'Available Gadgets';
                 $type = 'Gadget';
                 break;
             case 'motif':
                 $headline = 'Available Motifs';
                 $type = 'Motif';
                 break;
         }
     }
     $query = (string) ($post['query'] ?? '');
     $numAvailable = $this->skyport->countAvailable($type);
     list($page, $offset) = $this->getPaginated($numAvailable);
     $this->lens('skyport/list', ['headline' => $headline, 'extensions' => $this->skyport->getAvailable($type, $query, $offset, $this->perPage), 'pagination' => ['count' => $numAvailable, 'page' => $page, 'per_page' => $this->perPage]]);
 }