Skip to content
Snippets Groups Projects
Course.class.php 34.9 KiB
Newer Older
    /**
     *
     */
    public function setDefaultTools()
    {
        $this->tools = [];
        foreach (array_values($this->getSemClass()->getActivatedModuleObjects()) as $module) {
            PluginManager::getInstance()->setPluginActivated($module->getPluginId(), $this->id, true);
            $this->tools[] = ToolActivation::find([$this->id, $module->getPluginId()]);
        }
    }

    /**
     * @param $name string name of tool / plugin
     * @return bool
     */
    public function isToolActive($name)
    {
        $plugin = PluginEngine::getPlugin($name);
        return $plugin && $this->tools->findOneby('plugin_id', $plugin->getPluginId());
    }

    /**
     * returns all activated plugins/modules for this course
     * @return StudipModule[]
     */
    public function getActivatedTools()
    {
        return array_filter($this->tools->getStudipModule());
    }
Moritz Strohm's avatar
Moritz Strohm committed


    /**
     * @see Range::__toString()
     */
    public function __toString() : string
    {
        return $this->getFullName();
    }