本文整理汇总了PHP中Folder::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::setName方法的具体用法?PHP Folder::setName怎么用?PHP Folder::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::setName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToAPI
public function testToAPI()
{
$folder = new Folder();
$folder->setId(3);
$folder->setName('name');
$this->assertEquals(array('id' => 3, 'name' => 'name'), $folder->toAPI());
}
示例2: testSerialize
public function testSerialize()
{
$folder = new Folder();
$folder->setId(3);
$folder->setName('john');
$folder->setParentId(4);
$folder->setUserId('abc');
$folder->setOpened(true);
$folder->setDeletedAt(9);
$this->assertEquals(['id' => 3, 'parentId' => 4, 'name' => 'john', 'userId' => 'abc', 'opened' => true, 'deletedAt' => 9], $folder->jsonSerialize());
}
示例3: getNotDeletableForUser
/**
* @param sfGuardUser $user
* @param $type
* @param $create_if_not_exists
* @return mixed
*/
public function getNotDeletableForUser(sfGuardUser $user, $type, $create_if_not_exists = true)
{
$folder = $this->createQuery('f')->whereIn('f.user_id', sfGuardUserTable::getInstance()->getUsersInTeamIDs($user))->andWhere('f.deletable = ?', 0)->andWhere('f.type = ?', $type)->fetchOne();
if (!$folder && $create_if_not_exists) {
$folder = new Folder();
$folder->setName('Default');
$folder->setUserId($user->getId());
$folder->setDeletable(0);
$folder->setType($type);
$folder->save();
}
return $folder;
}
示例4: executeNewFolder
public function executeNewFolder(sfWebRequest $request)
{
$this->forward404Unless($request->isXmlHttpRequest());
$folder = new Folder();
$folder->setName('New ' . InterfaceLabelTable::getInstance()->get($this->getuser()->getGuardUser(), InterfaceLabelTable::FOLDER_TYPE));
$folder->setUser($this->getUser()->getGuardUser());
$folder->setType(Folder::TYPE_ROADMAP);
if (!Folder::getInstance()->getNotDeletableForUser($this->getUser()->getGuardUser(), Folder::TYPE_ROADMAP, false)) {
$folder->setDeletable(false);
}
$folder->save();
// Create log
$log = new Log();
$log->injectDataAndPersist($folder, $this->getUser()->getGuardUser(), array('action' => 'new'));
return $this->renderText(json_encode($folder->getRowData()));
}
示例5: handleRoadmaps
public function handleRoadmaps()
{
$default_folders = array();
$conn = Doctrine_Manager::getInstance()->connection();
$roadmaps = $conn->execute("SELECT id, user_id from `roadmap` WHERE folder_id is NULL")->fetchAll();
foreach ($roadmaps as $roadmap) {
if (!array_key_exists($roadmap['user_id'], $default_folders)) {
$folder = $conn->execute("SELECT id from `folder` WHERE `user_id` = :user_id and `type` = '" . Folder::TYPE_ROADMAP . "' and `deletable` = 0 LIMIT 1;", array(':user_id' => $roadmap['user_id']))->fetchAll();
if (count($folder)) {
$default_folders[$roadmap['user_id']] = $folder[0]['id'];
} else {
$folder = new Folder();
$folder->setName('Default');
$folder->setUserId($roadmap['user_id']);
$folder->setDeletable(0);
$folder->setType(Folder::TYPE_ROADMAP);
$folder->save();
$default_folders[$roadmap['user_id']] = $folder->getId();
}
}
$conn->execute("UPDATE `roadmap` SET `folder_id` = :folder_id WHERE id = :id", array(':folder_id' => $default_folders[$roadmap['user_id']], ':id' => $roadmap['id']));
}
}
示例6: User
// Suppose qu'il n'y a qu'un seul utilisateur
$userManager->truncate();
}
$userManager->create();
$admin = new User();
$admin->setLogin($_['login']);
$admin->setPassword($_['password'], $cryptographicSalt);
$admin->save();
$_SESSION['currentUser'] = serialize($admin);
// DOSSIERS DE FLUX, RECRÉE LE DOSSIER GÉNÉRAL SI NÉCESSAIRE
$folderManager = new Folder();
$folderManager->create();
if ($folderManager->rowCount() == 0) {
//Création du dossier général
$folder = new Folder();
$folder->setName(_t('GENERAL_FOLDER'));
$folder->setParent(-1);
$folder->setIsopen(1);
$folder->save();
}
// REMET À ZÉRO LA CONFIGURATION
$configurationManager = new Configuration();
if ($configurationManager->tableExists()) {
$configurationManager->truncate();
}
$configurationManager->create();
$configurationManager->add('articleDisplayAnonymous', '0');
$configurationManager->add('articleDisplayAuthor', '1');
$configurationManager->add('articleDisplayDate', '1');
$configurationManager->add('articleDisplayFolderSort', '1');
$configurationManager->add('articleDisplayHomeSort', '1');
示例7: getFolderInfo
/**
* Get Folder Info
*
* @param folderId - required -
* The id of the folder.
* @param includeFiles - optional -
* Default = true. If true, the API returns
* info about all the files in the specified folder, at this folder level only.
* @param includeFolders - optional -
* Default = true. If true, the API returns info about all
* the sub folders, at this folder level only
* @return The Folder object. If the operation was successful, the object contains the folder info, if not, the object
* contains the error code and message.
*/
public function getFolderInfo($folderId, $includeFiles = '', $includeFolders = '')
{
$parameters = array();
if ($includeFiles !== '') {
$parameters['includeFiles'] = $includeFiles;
}
if ($includeFolders !== '') {
$parameters['includeFolders'] = $includeFolders;
}
$urld = 'dpi/v1/folder/' . $folderId;
$this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_GET, $this->authToken);
$responseBody = simplexml_load_string($this->response);
$returnObject = new Folder();
if ($responseBody === false) {
$errorCode = 'N/A';
$errorMessage = 'The server has encountered an error, please try again.';
$errorObject = new ErrorStatus($errorCode, $errorMessage);
$returnObject->setErrorStatus($errorObject);
} else {
$errorStatus = $responseBody->errorStatus;
if (empty($errorStatus)) {
$returnObject->setRevision((string) $responseBody->attributes()->revision);
$returnObject->setId((string) $responseBody->attributes()->id);
$returnObject->setCreatedOn((string) $responseBody->createdOn);
$returnObject->setName((string) $responseBody->name);
$returnObject->setParentId((string) $responseBody->parentid);
$returnObject->setReadable((string) $responseBody->readable);
$returnObject->setSize((string) $responseBody->size);
$returnObject->setType((string) $responseBody->type);
$returnObject->setUpdatedOn((string) $responseBody->updatedOn);
$returnObject->setWritable((string) $responseBody->writeable);
$returnObject->setCurrentUsage((string) $responseBody->currentUsage);
$returnObject->setStorageQuota((string) $responseBody->storageQuota);
$fileCount = (string) $responseBody->fileCount;
$returnObject->setFileCount($fileCount);
$folderCount = (string) $responseBody->folderCount;
$returnObject->setFolderCount($folderCount);
if ($includeFiles) {
$filesTag = $responseBody->files;
if (!empty($filesTag)) {
$allFiles = $responseBody->files->children();
$files = array();
if (!empty($allFiles)) {
foreach ($allFiles as $currentFile) {
$file = new File();
$file->setRevision((string) $currentFile->attributes()->revision);
$file->setId((string) $currentFile->attributes()->id);
$file->setCreatedOn((string) $currentFile->createdOn);
$file->setName((string) $currentFile->name);
$file->setParentId((string) $currentFile->parentid);
$file->setSize((string) $currentFile->size);
array_push($files, $file);
}
$returnObject->setFiles($files);
}
}
}
if ($includeFolders) {
$foldersTag = $responseBody->folders;
if (!empty($foldersTag)) {
$allFolders = $responseBody->folders->children();
$folders = array();
if (!empty($allFolders)) {
foreach ($allFolders as $currentFolder) {
$folder = new Folder();
$folder->setRevision((string) $currentFolder->attributes()->revision);
$folder->setId((string) $currentFolder->attributes()->id);
$folder->setCreatedOn((string) $currentFolder->createdOn);
$folder->setCurrentUsage((string) $currentFolder->currentUsage);
$folder->setFileCount((string) $currentFolder->fileCount);
$folder->setFolderCount((string) $currentFolder->folderCount);
$folder->setName((string) $currentFolder->name);
$folder->setParentId((string) $currentFolder->parentid);
$folder->setReadable((string) $currentFolder->readable);
$folder->setSize((string) $currentFolder->size);
$folder->setType((string) $currentFolder->type);
$folder->setUpdatedOn((string) $currentFolder->updatedOn);
$folder->setWritable((string) $currentFolder->writeable);
$folder->setOwnedByUser((string) $currentFolder->ownedByUser);
array_push($folders, $folder);
}
$returnObject->setFolders($folders);
}
}
}
} else {
//.........这里部分代码省略.........
示例8: array
$feedManager->delete(array('id' => $_['id']));
$eventManager->delete(array('feed' => $_['id']));
Plugin::callHook("action_after_removeFeed", array($_['id']));
}
header('location: ./settings.php');
break;
case 'addFolder':
if ($myUser == false) {
exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
}
if (isset($_['newFolder'])) {
$folder = new Folder();
if ($folder->rowCount(array('name' => $_['newFolder'])) == 0) {
$folder->setParent(-1);
$folder->setIsopen(0);
$folder->setName($_['newFolder']);
$folder->save();
}
}
header('location: ./settings.php');
break;
case 'renameFolder':
if ($myUser == false) {
exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
}
if (isset($_['id'])) {
$folderManager->change(array('name' => $_['name']), array('id' => $_['id']));
}
break;
case 'renameFeed':
if ($myUser == false) {
示例9: createRootAndChildFolder
/**
* @param array $params
* @return string
*/
public function createRootAndChildFolder($params)
{
$parent = new Folder();
$parent->setCreatedTime(new \DateTime());
$child = new Folder();
$child->setCreatedTime(new \DateTime())->setParentFolder($parent);
if (isset($params['root-folder-path'])) {
$parent->setPath($params['root-folder-path']['value']);
}
if (isset($params['root-folder-name'])) {
$parent->setName($params['root-folder-name']['value']);
}
if (isset($params['child-folder-path'])) {
$child->setPath($params['child-folder-path']['value']);
}
if (isset($params['child-folder-name'])) {
$child->setName($params['child-folder-name']['value']);
}
try {
$child = $this->fs->createFolder($child, $parent);
return 'Root folder with id: ' . $parent->getId() . ' and child folder with id: ' . $child->getId() . ' created successfully';
} catch (\Exception $ex) {
return $ex->getMessage();
}
}
示例10: header
include_once 'includes/header.php';
if (isset($_POST['new_file'])) {
$folder->setPath(!empty($_POST['dir']) ? $_POST['dir'] : 'storage');
$file->setName($_POST['filename']);
if ($system->createFile($file, $folder)) {
header("location: ?dir=" . $folder->getPath());
} else {
echo "Error: Failed to create file. <a href='/FMS/index.php?dir=" . $folder->getPath() . "'>Go back!</a>";
}
exit;
} else {
if (isset($_POST['new_folder'])) {
$folder->setPath(!empty($_POST['dir']) ? $_POST['dir'] : 'storage');
$newfolder = new Folder();
$newfolder->setName($_POST['foldername']);
if ($system->createFolder($newfolder, $folder)) {
header("location: ?dir=" . $folder->getPath());
} else {
echo "Error: Failed to create folder. <a href='/FMS/index.php?dir=" . $folder->getPath() . "'>Go back!</a>";
}
exit;
} else {
if (isset($_POST['rename_file'])) {
$folder->setPath($_GET['dir']);
$file->setParentFolder($folder);
$file->setName($_GET['file']);
if ($system->renameFile($file, $_POST['new_filename'])) {
header("location: ?dir=" . $folder->getPath());
} else {
echo "Error: Failed to rename file. <a href='/FMS/index.php?dir=" . $folder->getPath() . "'>Go back!</a>";