/** * Note, this queries both the pkgID found on the PermissionKeys table AND any permission keys of a special type * installed by that package, and any in categories by that package. */ public static function getListByPackage($pkg) { $db = Loader::db(); $kina[] = '-1'; $kinb = $db->GetCol('select pkCategoryID from PermissionKeyCategories where pkgID = ?', array($pkg->getPackageID())); if (is_array($kinb)) { $kina = array_merge($kina, $kinb); } $kinstr = implode(',', $kina); $r = $db->Execute('select pkID, pkCategoryID from PermissionKeys where (pkgID = ? or pkCategoryID in (' . $kinstr . ')) order by pkID asc', array($pkg->getPackageID())); while ($row = $r->FetchRow()) { $pkc = PermissionKeyCategory::getByID($row['pkCategoryID']); $pk = $pkc->getPermissionKeyByID($row['pkID']); $list[] = $pk; } $r->Close(); return $list; }