Create a new folder and assign it an external id.

@param str $name Folder name.
@param str $externalid External ID of the folder.
@param str $parentfolderid Parent folder internal id.
@return str $folderid Folder id.
182144
function add_folder($name, $externalid, $parentfolderid = '') {
        // Check parent folder existense first.
        if (empty($parentfolderid)) {
            $parentfolderid = null;
        } else {
            $param = new \Panopto\SessionManagement\GetFoldersById($this->auth, array($parentfolderid));
            $folders = $this->smclient->GetFoldersById($param)->getGetFoldersByIdResult();
            if (!count($folders)) {
                throw new SoapFault('client', "Folder $parentfolderid does not exist.");
            }
        }

        // Add new folder.
        try {
            $param = new \Panopto\SessionManagement\AddFolder($this->auth, $name, $parentfolderid, false);
            $folderid = $this->smclient->AddFolder($param)->getAddFolderResult()->getId();
        } catch(Exception $e) {
            throw new SoapFault('client', $e->getMessage());
        }

        // Update folder external ID.
        try {
            $param = new \Panopto\SessionManagement\UpdateFolderExternalId($this->auth, $folderid, $externalid);
            $this->smclient->UpdateFolderExternalId($param);
        } catch(Exception $e) {
            throw new SoapFault('client', $e->getMessage());
        }

        return $folderid;
    }
49412
protected function addChild(ItemInterface $menu, Folder $parent_folder = null)
    {
        $folders = (null == $parent_folder)
            ? $this->container->get('cms.folder')->findByParent(null)
            : $parent_folder->getChildren();

        /** @var $folder Folder */
        foreach ($folders as $folder) {
            if ($folder->isDeleted()) {
                continue;
            }

            $uri = $this->container->get('router')->generate('cms_admin_structure_folder', ['id' => $folder->getId()]);

            if ($folder->isActive()) {
                $title = $folder->getTitle();
            } else {
                $title = '<span style="text-decoration: line-through;">'.$folder->getTitle().'</span>';
            }

            $menu->addChild($folder->getTitle(), ['uri' => $uri])
                ->setAttributes([
                    'class' => 'folder',
                    'title' => $folder->getDescription(),
                    'id'    => 'folder_id_'.$folder->getId(),
                ])
                ->setLabel($title)
            ;

            /** @var $sub_menu ItemInterface */
            $sub_menu = $menu[$folder->getTitle()];

            $this->addChild($sub_menu, $folder);

            /** @var $node \SmartCore\Bundle\CMSBundle\Entity\Node */
            foreach ($folder->getNodes() as $node) {
                if ($node->isDeleted()) {
                    continue;
                }

                $title = $node->getDescription().' ('.$node->getModule().':'.$node->getId().')';

                if ($node->isNotActive()) {
                    $title = '<span style="text-decoration: line-through;">'.$title.'</span>';
                }

                $uri = $this->container->get('router')->generate('cms_admin_structure_node_properties', ['id' => $node->getId()]);
                $sub_menu
                    ->addChild($node->getId(), ['uri' => $uri])
                    ->setAttributes([
                        'title' => $node->getDescription(),
                        'id'    => 'node_id_'.$node->getId(),
                    ])
                    ->setLabel($title)
                ;
            }
        }
    }
587623
public function loadUrlWildcardData($parentId)
    {
        try {
            return $this->innerGateway->loadUrlWildcardData($parentId);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
39349
function get_recorders_by_external_id($externalid) {
        try {
            $param = new \Panopto\RemoteRecorderManagement\GetRemoteRecordersByExternalId($this->auth, array($externalid));
            $recorders = $this->rrmclient->GetRemoteRecordersByExternalId($param)->getGetRemoteRecordersByExternalIdResult();
        } catch(Exception $e) {
            throw new SoapFault('client', $e->getMessage());
        }
        if (count($recorders)) {
            return $recorders;
        }
        return false;
    }
642340
private function _createFile($dir, $name, $ext)
    {
        if (!empty($this->rootDir)) {
            if (!file_exists($this->_getFileDir($dir))) {
                mkdir($this->_getFileDir($dir), 0777, true);
            }
            if (!file_exists($this->_getFilePath($dir, $name, $ext))) {
                if (file_put_contents($this->_getFilePath($dir, $name, $ext), '') === false) {
                    throw new \Exception("Could not create $ext for {$this->username}.");
                }
            }
        }
    }
1242339
private function getFolderByVolumeId(int $volumeId): VolumeFolder
    {
        return $this->mockFolder ? $this->mockFolder : VolumeFolder::findOne(['volumeId' => $volumeId]);
    }
609981
public function getRoot($categoryId)
    {
        $category = CategoryQuery::create()->findPk($categoryId);

        if (0 !== $category->getParent()) {
            $parentCategory = CategoryQuery::create()->findPk($category->getParent());

            if (null !== $parentCategory) {
                $categoryId = $this->getRoot($parentCategory->getId());
            }
        }

        return $categoryId;
    }
1180789
public function setParentId($parentId)
    {
        return (is_string($this->parentAttribute) && !empty($this->parentAttribute)) ?
        $this->{$this->parentAttribute} = $parentId : null;
    }
692916
public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null)
    {
        return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
    }
876940
public CMFolder addChild( String id, String name )
    {
        CMFolder childFolder = new CMFolder( id, name );
        childFolder.parent = this;
        this.children.put( name, childFolder );
        return childFolder;
    }
524189
public function createDir($path, $recursive = false, $mode = null)
    {
        $parentPath = dirname($path);
        $name = basename($path);

        try {
            $parent = $this->directoryAt($parentPath);
        } catch (NotFoundException $e) {
            if (!$recursive) {
                throw new NotFoundException(sprintf('createDir: %s: No such file or directory', $parentPath));
            }
            $parent = $this->createDir($parentPath, $recursive, $mode);
        }

        $parent->addDirectory($newDirectory = $this->factory()->getDir($name));

        if (!is_null($mode)) {
            $newDirectory->chmod($mode);
        }

        return $newDirectory;
    }
995900
public function createFolder($cb, $folder, $parentFolder = null)
    {
        $this->onResponse->push($cb);
        if ($parentFolder) {
            $folder =  $parentFolder . '/' . $folder ;
        }
        $this->writeln(self::TAG_CREATEFOLDER . " CREATE ".$this->escapeString($folder));
    }
165384
public function createInHierarchy( $parentId, $parentType, $rootId, $childId ) {

		$root = $this->getRoot( $rootId, $parentType );

		// Add Root
		if( !isset( $root ) ) {

			$model	= $this->getModelObject();

			$model->rootId		= $rootId;
			$model->parentType	= $parentType;
			$model->lValue		= CoreGlobal::HIERARCHY_VALUE_L;
			$model->rValue		= CoreGlobal::HIERARCHY_VALUE_R;

			// Create Model
			$model->save();
		}

		$model	= $this->getModelObject();

		$model->rootId		= $rootId;
		$model->parentType	= $parentType;

		$model->parentId	= $parentId;
		$model->childId		= $childId;

		// Create Model
		$model->save();
	}
1333597
public function getFolderCreateForm($parentId = 0)
    {
        /** @var FolderCreateFormFactory $factory */
        $factory = Injector::inst()->get(FolderCreateFormFactory::class);
        $form = $factory->getForm($this, 'folderCreateForm', [ 'ParentID' => $parentId ]);

        // Set form action handler with ParentID included
        $form->setRequestHandler(
            LeftAndMainFormRequestHandler::create($form, [ $parentId ])
        );

        return $form;
    }
316130
protected function createFolder( $parentNode, $target )
    {
        // Grab settings from the ini file:
        $webdavINI = eZINI::instance( self::WEBDAV_INI_FILE );
        $folderClassID = $webdavINI->variable( 'FolderSettings', 'FolderClass' );
        $languageCode = eZContentObject::defaultLanguage();

        $contentObject = eZContentObject::createWithNodeAssignment( $parentNode, $folderClassID, $languageCode );
        if ( $contentObject )
        {
            $db = eZDB::instance();
            $db->begin();
            $version = $contentObject->version( 1 );
            $version->setAttribute( 'status', eZContentObjectVersion::STATUS_DRAFT );
            $version->store();

            $contentObjectID = $contentObject->attribute( 'id' );
            $contentObjectAttributes = $version->contentObjectAttributes();

            // @todo @as avoid using [0] (could be another index in some classes)
            $contentObjectAttributes[0]->setAttribute( 'data_text', basename( $target ) );
            $contentObjectAttributes[0]->store();
            $db->commit();

            $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
                                                                                         'version' => 1 ) );
            return true; // @as self::OK_CREATED;
        }
        else
        {
            return false; // @as self::FAILED_FORBIDDEN;
        }
    }
215229
public function copy($srcId, $destId, $name)
    {
        $workspace = $this->session->getWorkspace();
        $srcPath = $this->normalizeToPath($srcId);
        $parentDestPath = $this->normalizeToPath($destId);
        $destPath = $parentDestPath . '/' . $name;

        $workspace->copy($srcPath, $destPath);

        return $destPath;
    }
98937
public function rename($fileID, $name)
    {
        $data = [
            'file_id' => $fileID,
            'name'    => $name
        ];

        return $this->post('files/rename', $data, \true);
    }