Create scool study submodule using ebre-escool study submodule.

@param StudySubModule $srcSubmodule
@return ScoolSubmodule
168043
protected function createSubmodule(StudySubModule $srcSubmodule)
    {
        //First Or new
        $id = $this->SubModuleAlreadyExists($srcSubmodule);
        if ($id != null) {
            $submodule = Submodule::findOrFail($id);
        } else {
            $submodule = new Submodule();
        }

        $submodule->name = $srcSubmodule->name;
        $submodule->order = $srcSubmodule->order;
        $submodule->type = $this->mapTypes($srcSubmodule->type->id);
        $submodule->save();
        $submodule->altnames = [
            'shortname'   => $srcSubmodule->shortname,
            'description' => $srcSubmodule->description
        ];

        $submodule->addModule($this->getScoolModule());
        return $submodule;
    }
17893
protected function subModules()
    {
        $repo = $this->repo;
        $output = $this->command('submodule status');

        if ($output) {
            foreach ($output as $line) {
                $line = explode(' ', trim($line));
                $this->submodules[] = array(
                    'revision' => $line[0],
                    'name' => $line[1],
                    'path' => $repo.'/'.$line[1]
                );
                $this->ignoredFiles[] = $line[1];
                $this->checkSubSubmodules($repo, $line[1]);
            }
        }
    }
850296
function getSubmodules(packageRoot) {
  const submodules = {};
  const parentPath = resolve(packageRoot, './modules');

  if (fs.existsSync(parentPath)) {
    //monorepo
    fs.readdirSync(parentPath)
    .forEach(item => {
      const itemPath = resolve(parentPath, item);
      const moduleInfo = getModuleInfo(itemPath);
      if (moduleInfo) {
        submodules[moduleInfo.name] = moduleInfo;
      }
    });
  } else {
    const moduleInfo = getModuleInfo(packageRoot);
    submodules[moduleInfo.name] = moduleInfo;
  }

  return submodules;
}
1057230
public function AddSource($header_name, &$content, $subdir="src")
    {
        if($subdir)
        {
            $subdir = trim($subdir, "\\/") . "/";
            
            if(!file_exists($this->output_path . $subdir))
                \Peg\Lib\Utilities\FileSystem::MakeDir(
                    $this->output_path . $subdir, 
                    0755, 
                    true
                );
        }
        
        $header = $this->output_path 
            . $subdir
            . $this->GetSourceNamePHP($header_name)
        ;
        
        \Peg\Lib\Utilities\FileSystem::WriteFileIfDifferent($header, $content);
    }
17454
public function modules()
    {
        $courses = $this->courses->pluck('course_id');
        return StudyModule::whereHas('modulesByPeriod.courses', function ($query) use ($courses)  {
            $query->whereIn('course_id',$courses);
        });
    }
404202
protected function makeChildClassesAggregateRoot(ClassSchema $classSchema)
    {
        foreach ($this->getAllSubClassNamesForClass($classSchema->getClassName()) as $childClassName) {
            if (!isset($this->classSchemata[$childClassName]) || $this->classSchemata[$childClassName]->isAggregateRoot()) {
                continue;
            }

            $this->classSchemata[$childClassName]->setRepositoryClassName($classSchema->getRepositoryClassName());
            $this->makeChildClassesAggregateRoot($this->classSchemata[$childClassName]);
        }
    }
430467
private CmsModule createModuleFolders(CmsObject cms, CmsModule module) throws CmsException {

        String modulePath = CmsWorkplace.VFS_PATH_MODULES + module.getName() + "/";
        List<CmsExportPoint> exportPoints = module.getExportPoints();
        List<String> resources = module.getResources();

        // set the createModuleFolder flag if any other flag is set
        if (module.isCreateClassesFolder()
            || module.isCreateElementsFolder()
            || module.isCreateI18NFolder()
            || module.isCreateLibFolder()
            || module.isCreateResourcesFolder()
            || module.isCreateSchemasFolder()
            || module.isCreateTemplateFolder()
            || module.isCreateFormattersFolder()) {
            module.setCreateModuleFolder(true);
        }

        Set<String> exportPointPaths = new HashSet<String>();
        for (CmsExportPoint exportPoint : exportPoints) {
            exportPointPaths.add(exportPoint.getUri());
        }

        // check if we have to create the module folder

        I_CmsResourceType folderType = OpenCms.getResourceManager().getResourceType(
            CmsResourceTypeFolder.getStaticTypeName());
        I_CmsResourceType configType = OpenCms.getResourceManager().getResourceType(CmsADEManager.MODULE_CONFIG_TYPE);

        if (module.isCreateModuleFolder()) {
            CmsResource resource = cms.createResource(modulePath, folderType);
            CmsResource configResource = cms.createResource(modulePath + CONFIG_FILE, configType);
            try {
                cms.unlockResource(resource);
                cms.unlockResource(configResource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
            // add the module folder to the resource list
            resources.add(modulePath);
            module.setResources(resources);
        }

        // check if we have to create the template folder
        if (module.isCreateTemplateFolder()) {
            String path = modulePath + PATH_TEMPLATES;
            CmsResource resource = cms.createResource(path, folderType);
            try {
                cms.unlockResource(resource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
        }

        if (module.isCreateI18NFolder()) {
            String path = modulePath + PATH_i18n;
            CmsResource resource = cms.createResource(path, folderType);
            CmsResource bundleResource = cms.createResource(
                path + module.getName() + SUFFIX_BUNDLE_FILE + "_" + CmsLocaleManager.getDefaultLocale(),
                OpenCms.getResourceManager().getResourceType(CmsVfsBundleManager.TYPE_PROPERTIES_BUNDLE),
                null,
                null);
            cms.writeResource(bundleResource);
            try {
                cms.unlockResource(resource);
                cms.unlockResource(bundleResource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
        }

        // check if we have to create the elements folder
        if (module.isCreateElementsFolder()) {
            String path = modulePath + PATH_ELEMENTS;
            CmsResource resource = cms.createResource(path, folderType);
            try {
                cms.unlockResource(resource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
        }

        if (module.isCreateFormattersFolder()) {
            String path = modulePath + PATH_FORMATTERS;
            CmsResource resource = cms.createResource(path, folderType);
            try {
                cms.unlockResource(resource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
        }

        // check if we have to create the schemas folder
        if (module.isCreateSchemasFolder()) {
            String path = modulePath + PATH_SCHEMAS;
            CmsResource resource = cms.createResource(path, folderType);
            try {
                cms.unlockResource(resource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
        }

        // check if we have to create the resources folder
        if (module.isCreateResourcesFolder()) {
            String path = modulePath + PATH_RESOURCES;
            CmsResource resource = cms.createResource(path, folderType);
            try {
                cms.unlockResource(resource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
        }

        // check if we have to create the lib folder
        if (module.isCreateLibFolder()) {
            String path = modulePath + PATH_LIB;
            CmsResource resource = cms.createResource(path, folderType);
            try {
                cms.unlockResource(resource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
            if (!exportPointPaths.contains(path)) {
                CmsExportPoint exp = new CmsExportPoint(path, "WEB-INF/lib/");
                exportPoints.add(exp);
            }
            module.setExportPoints(exportPoints);
        }

        // check if we have to create the classes folder
        if (module.isCreateClassesFolder()) {
            String path = modulePath + PATH_CLASSES;
            CmsResource resource = cms.createResource(path, folderType);
            try {
                cms.unlockResource(resource);
            } catch (CmsLockException locke) {
                LOG.warn("Unbale to unlock resource", locke);
            }
            if (!exportPointPaths.contains(path)) {
                CmsExportPoint exp = new CmsExportPoint(path, "WEB-INF/classes/");
                exportPoints.add(exp);
                module.setExportPoints(exportPoints);
            }

            // now create all subfolders for the package structure
            StringTokenizer tok = new StringTokenizer(m_module.getName(), ".");
            while (tok.hasMoreTokens()) {
                String folder = tok.nextToken();
                path += folder + "/";
                CmsResource resource2 = cms.createResource(path, folderType);
                try {
                    cms.unlockResource(resource2);
                } catch (CmsLockException locke) {
                    LOG.warn("Unbale to unlock resource", locke);
                }
            }
        }
        return module;
    }
1138327
final public function registerModule(FrameworkModuleDataStructure $module)
    {
        // Push Subdomain App Module
        modules()->push($module);

        // Add Config FilePath
        config()->addFilePath($module->getRealPath());

        // Reload Config
        config()->reload();

        // Load modular addresses config
        if (false !== ($configDir = $module->getDir('config', true))) {
            unset($addresses);

            $reconfig = false;
            if (is_file(
                $filePath = $configDir . ucfirst(
                        strtolower(ENVIRONMENT)
                    ) . DIRECTORY_SEPARATOR . 'Addresses.php'
            )) {
                require($filePath);
                $reconfig = true;
            } elseif (is_file(
                $filePath = $configDir . 'Addresses.php'
            )) {
                require($filePath);
                $reconfig = true;
            }

            if ( ! $reconfig) {
                $controllerNamespace = $module->getNamespace() . 'Controllers\\';
                $controllerClassName = $controllerNamespace . studlycase($module->getParameter());

                if (class_exists($controllerClassName)) {
                    $this->addresses->any(
                        '/',
                        function () use ($controllerClassName) {
                            return new $controllerClassName();
                        }
                    );
                }
            } elseif (isset($addresses)) {
                $this->addresses = $addresses;
            }
        } else {
            $controllerNamespace = $module->getNamespace() . 'Controllers\\';
            $controllerClassName = $controllerNamespace . studlycase($module->getParameter());

            if (class_exists($controllerClassName)) {
                $this->addresses->any(
                    '/',
                    function () use ($controllerClassName) {
                        return new $controllerClassName();
                    }
                );
            }
        }
    }
322397
private function copyUninlineableCssToStyleNode(\DOMXPath $xPath, array $cssRules)
    {
        $cssRulesRelevantForDocument = \array_filter(
            $cssRules,
            function (array $cssRule) use ($xPath) {
                $selector = $cssRule['selector'];
                if ($cssRule['hasUnmatchablePseudo']) {
                    $selector = $this->removeUnmatchablePseudoComponents($selector);
                }
                return $this->existsMatchForCssSelector($xPath, $selector);
            }
        );

        if ($cssRulesRelevantForDocument === []) {
            // avoid adding empty style element (or including unneeded class dependency)
            return;
        }

        $cssConcatenator = new CssConcatenator();
        foreach ($cssRulesRelevantForDocument as $cssRule) {
            $cssConcatenator->append([$cssRule['selector']], $cssRule['declarationsBlock'], $cssRule['media']);
        }

        $this->addStyleElementToDocument($cssConcatenator->getCss());
    }
894244
public function setSubcategory(\Innova\LexiconBundle\Entity\Subcategory $subcategory = null)
    {
        $this->subcategory = $subcategory;

        return $this;
    }
591485
public function createUniqueLabel(core_kernel_classes_Class $clazz, $subClassing = false)
    {
        if ($subClassing) {
            $labelBase = $clazz->getLabel() . '_' ;
            $count = count($clazz->getSubClasses()) +1;
        } else {
            $labelBase = $clazz->getLabel() . ' ' ;
            $count = count($clazz->getInstances()) +1;
        }

        $options = [
            'lang'              => \common_session_SessionManager::getSession()->getDataLanguage(),
            'like'              => false,
            'recursive'         => false
        ];

        do {
            $exist = false;
            $label =  $labelBase . $count;
            $result = $clazz->searchInstances(array(OntologyRdfs::RDFS_LABEL => $label), $options);
            if (count($result) > 0) {
                $exist = true;
                $count ++;
            }
        } while ($exist);

        return (string) $label;
    }
554957
public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) {
        if (softwareModules == null) {
            softwareModules = new ArrayList<>();
        }

        softwareModules.add(createSoftwareModule);

    }
340814
public function getSubmodules($mainIdentifier)
    {
        return array_filter($this->getModules(), function (ModuleInterface $module) use ($mainIdentifier) {
            return ($module instanceof SubmoduleInterface)
                && $module->getParentIdentifier() == $mainIdentifier;
        });
    }
179918
public function createSubModule ($className)
		{
			if (! class_exists($className) || ! is_subclass_of($className, '\LiftKit\Module\Module')) {
				throw new NonexistentSubModuleException('Class name is not module: ' . $className);
			}

			return new $className($this->container);
		}
1211574
public function moduleClasses($classes, $moduleType, $sidebarArgs)
    {
        // Box panel in content area and content area bottom
        if (in_array($sidebarArgs['id'], array('content-area', 'content-area-bottom')) && in_array('box-panel', $classes) && !is_front_page()) {
            $classes[] = 'box-panel-secondary';
        }

        // Inline box panels
        if (is_numeric($sidebarArgs['id']) && in_array('box-panel', $classes)) {
            $classes[] = 'box-panel-secondary';
        }

        // Sidebar box-panel (should be filled)
        if (in_array($sidebarArgs['id'], array('left-sidebar-bottom', 'left-sidebar', 'right-sidebar')) && in_array('box-panel', $classes)) {
            unset($classes[array_search('box-panel', $classes)]);
            $classes[] = 'box-filled';
        }

        // Sidebar box-index (should be filled)
        if (in_array($sidebarArgs['id'], array('left-sidebar-bottom', 'left-sidebar', 'right-sidebar')) && in_array('box-index', $classes)) {
            unset($classes[array_search('box-index', $classes)]);
            $classes[] = 'box-filled';
        }

        // Sidebar box-news-horizontal (should be only box-news in sidebar)
        if (in_array($sidebarArgs['id'], array('left-sidebar-bottom', 'left-sidebar', 'right-sidebar')) && in_array('box-news-horizontal', $classes)) {
            unset($classes[array_search('box-news-horizontal', $classes)]);
        }

        return $classes;
    }
111104
public function createStructureModule($module, $force = false, $type = "", $apiClass = "")
    {
        $mod_path = CORE_DIR . DIRECTORY_SEPARATOR;
        $module = ucfirst($module);
        $this->createModulePath($module, $mod_path);
        $this->createModulePathTree($module, $mod_path);
        $this->createModuleBaseFiles($module, $mod_path, $force, $type);
        $this->createModuleModels($module, $mod_path);
        $this->generateBaseApiTemplate($module, $mod_path, $force, $apiClass);
        //Redireccionamos al home definido
        $this->log->addLog("Módulo generado correctamente");
    }
481713
protected function createModule(StudyModuleAcademicPeriod $studyModule)
    {
        $module = ScoolModule::firstOrNew([
            'name'         => $studyModule->name,
            'study_id'     => $this->getScoolStudy()->id
        ]);
        if($studyModule->study_shortname != $this->getScoolStudy()->shortname) {
            throw new \LogicException(
                'study_shortname in Ebre-escool study module (' . $studyModule->study_shortname
                . ") doesn't match study shortname (" . $this->getScoolStudy()->shortname . ')');
        }
        $module->save();
        $module->order = $studyModule->order;
        $module->shortname = $studyModule->shortname;
        $module->description = $studyModule->description;
        return $module;
    }