getExtensionById('taoBackOffice'); } /** * (non-PHPdoc) * @see \oat\oatbox\AbstractRegistry::getConfigId() */ protected function getConfigId() { return 'classActionRegistry'; } /** * Returns all the actions associated with this class and its parents * * @param core_kernel_classes_Class $class * @return array an array of Action */ public function getClassActions(core_kernel_classes_Class $class) { $actions = []; foreach ($this->getRelevantClasses($class) as $rClass) { if ($this->isRegistered($rClass->getUri())) { $actions = array_merge($actions, $this->get($rClass->getUri())); } } return $actions; } /** * Register an action with a class * * @param core_kernel_classes_Class $class * @param Action $action */ public function registerAction(core_kernel_classes_Class $class, Action $action) { $actions = $this->isRegistered($class->getUri()) ? $this->get($class->getUri()) : []; $actions[$action->getId()] = $action; $this->set($class->getUri(), $actions); MenuService::flushCache(); } public function unregisterAction(core_kernel_classes_Class $class, Action $action) { $actions = $this->isRegistered($class->getUri()) ? $this->get($class->getUri()) : []; unset($actions[$action->getId()]); $this->set($class->getUri(), $actions); MenuService::flushCache(); } private function getRelevantClasses(core_kernel_classes_Class $class) { $toDo = [$class->getUri() => $class]; $classes = []; while (!empty($toDo)) { $current = array_pop($toDo); $classes[$current->getUri()] = $current; if (!in_array($current->getUri(), [TaoOntology::OBJECT_CLASS_URI, GenerisRdf::CLASS_GENERIS_RESOURCE, OntologyRdfs::RDFS_CLASS ])) { foreach ($current->getParentClasses(false) as $parent) { if (!in_array($parent->getUri(), array_keys($classes))) { $toDo[$parent->getUri()] = $parent; } } } } return $classes; } }