/** * Get the asset group by ID * * @param int $id * * @return BaseGroup|null * * @throws \Exception */ public static function getAssetGroupById($id) { $model = AssetGroupModel::findByPk($id); if ($model === null) { throw new \Exception(sprintf('Unable to find the asset group ID %s', $id)); } return static::getAssetGroupByModel($model); }
/** * Get the groups of particular type * * @param array $types * * @return array */ protected function getGroups(array $types) { $groups = array(); $groupsCollection = AssetGroupModel::findBy(array("type IN ('" . implode("','", $types) . "')"), null, array('order' => 'name')); if ($groupsCollection !== null) { foreach ($groupsCollection as $group) { $groups[$group->id] = $group->name; } } return $groups; }
/** * Get the groups of particular type * * @param string $type * * @return array */ protected function getGroups($type) { $groups = array(); $groupsCollection = AssetGroupModel::findBy('type', $type, array('order' => 'name')); if ($groupsCollection !== null) { foreach ($groupsCollection as $group) { $groups[$group->id] = $group->name; } } return $groups; }
/** * Get the editor sheets of the current theme * * @param \DataContainer $dc * * @return array */ public function getEditorSheets(\DataContainer $dc) { $assetModel = AssetModel::findByPk($dc->id); $groupModel = AssetGroupModel::findByPk($assetModel->pid); $sheetModels = \StyleSheetModel::findBy('pid', $groupModel->pid, array('order' => 'name')); if ($sheetModels === null) { return array(); } $return = array(); foreach ($sheetModels as $sheetModel) { $return[$sheetModel->id] = $sheetModel->name; } return $return; }