public function getTopLevelLicenseRefs() { $licenseView = new LicenseViewProxy($this->groupId, array('columns' => array('rf_pk', 'rf_shortname', 'rf_fullname')), 'license_visible'); $query = $licenseView->asCTE() . ' SELECT rf_pk, rf_shortname, rf_fullname FROM ' . $licenseView->getDbViewName() . ' LEFT JOIN license_map ON rf_pk=rf_fk AND rf_fk!=rf_parent AND usage=$1' . ' WHERE license_map_pk IS NULL'; $stmt = __METHOD__ . ".{$this->usageId},{$this->groupId}"; $this->dbManager->prepare($stmt, $query); $res = $this->dbManager->execute($stmt, array($this->usageId)); $topLevel = array(); while ($row = $this->dbManager->fetchArray($res)) { $topLevel[$row['rf_pk']] = new LicenseRef($row['rf_pk'], $row['rf_shortname'], $row['rf_fullname']); } return $topLevel; }
/** * @return array */ public function getLicenseArray($groupId = null) { $statementName = __METHOD__; $rfTable = 'license_all'; $options = array('columns' => array('rf_pk', 'rf_shortname', 'rf_fullname'), 'candidatePrefix' => $this->candidatePrefix); if ($groupId === null) { $groupId = isset($_SESSION) && array_key_exists('GroupId', $_SESSION) ? $_SESSION['GroupId'] : 0; } $licenseViewDao = new LicenseViewProxy($groupId, $options, $rfTable); $withCte = $licenseViewDao->asCTE(); $this->dbManager->prepare($statementName, $withCte . " select rf_pk id,rf_shortname shortname,rf_fullname fullname from {$rfTable} order by LOWER(rf_shortname)"); $result = $this->dbManager->execute($statementName); $licenseRefs = $this->dbManager->fetchAll($result); $this->dbManager->freeResult($result); return $licenseRefs; }