Airship\Cabin\Bridge\Blueprint\Skyport::getInstalled PHP Method

getInstalled() public method

Get a list of all installed packages
public getInstalled ( boolean $grouped = false, integer $offset, integer $limit = 20 ) : array
$grouped boolean Group by type? (Creates 2D array)
$offset integer
$limit integer
return array
    public function getInstalled(bool $grouped = false, int $offset = 0, int $limit = 20) : array
    {
        $exts = $this->db->run('
            SELECT
                *
            FROM
                airship_package_cache
            WHERE
                installed
            ORDER BY
                packagetype ASC,
                supplier ASC,
                name ASC
            OFFSET ' . $offset . '
            LIMIT ' . $limit);
        if ($grouped) {
            $groups = ['Core' => [], 'Cabin' => [], 'Gadget' => [], 'Motif' => []];
            foreach ($exts as $ext) {
                $groups[$ext['packagetype']] = $ext;
            }
            return $groups;
        }
        return $exts;
    }

Usage Example

Example #1
0
 /**
  * @route ajax/admin/skyport/installed
  */
 public function ajaxGetInstalledPackages()
 {
     $numInstalled = $this->skyport->countInstalled();
     list($page, $offset) = $this->getPaginated($numInstalled);
     $this->lens('skyport/list', ['headline' => 'Installed Extensions', 'extensions' => $this->skyport->getInstalled(false, $offset, $this->perPage), 'pagination' => ['count' => $numInstalled, 'page' => $page, 'per_page' => $this->perPage]]);
 }