当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::save方法代码示例

本文整理汇总了PHP中Folder::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::save方法的具体用法?PHP Folder::save怎么用?PHP Folder::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


在下文中一共展示了Folder::save方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:sensorsix,项目名称:app,代码行数:19,代码来源:FolderTable.class.php

示例2: save

 /**
  * @description Apply settings
  */
 public function save()
 {
     if ($this->isset == false) {
         // If the file does not exist check his way, create a folder that does not exist
         $folder = new Folder(dirname($this->path));
         $folder->save();
     }
     $mode = self::MODE_ADD_CONTENT;
     if ($this->newContentReplace) {
         $mode = self::MODE_REPLACE_CONTENT;
     }
     $this->write($mode);
     // and set configs to file
     $this->update();
 }
开发者ID:ufo-cms,项目名称:file-system,代码行数:18,代码来源:File.php

示例3: 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()));
 }
开发者ID:sensorsix,项目名称:app,代码行数:16,代码来源:actions.class.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::except(array('_token', '_method'));
     $trimmedData = $this->trimData($data, array());
     $folder = Folder::where('name', $trimmedData['name'])->get()->first();
     if (!empty($folder)) {
         Session::flash('flash_error', trans('message.folder.error.already_exist'));
         return Redirect::route('secured.folder.create')->withInput();
     }
     $currentUser = $this->getCurrentUser();
     $folder = new Folder();
     $folder->fill($trimmedData);
     $folder->owner_id = $currentUser->id;
     if (!$folder->save()) {
         $errors = $folder->errors();
         return Redirect::route('secured.folder.create')->withInput()->withErrors($errors);
     }
     return Redirect::route('secured.folder.index');
 }
开发者ID:hungdo89,项目名称:file-manager,代码行数:24,代码来源:FolderController.php

示例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']));
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:23,代码来源:106_move_decision_and_roadmap_to_folder.php

示例6: User

 $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');
 $configurationManager->add('articleDisplayLink', '1');
 $configurationManager->add('articleDisplayMode', 'summary');
 $configurationManager->add('articlePerPages', '5');
开发者ID:Chouchen,项目名称:Leed,代码行数:31,代码来源:install.php

示例7: executeAccountCreate


//.........这里部分代码省略.........
         }
         ////////// GET SAVE FOLDERS //////////////
         $userFolders = array();
         $mediaFolders = array();
         $alphaFolder = false;
         $mediaAlphaFolder = false;
         $rootfolderUser = Rootfolder::getRootfolderByModule('user');
         $rootfolderMedia = Rootfolder::getRootfolderByModule('media');
         if ($rootfolderUser) {
             $folders = Document::getChildrenOf($rootfolderUser->getId(), 'Folder');
         }
         if ($rootfolderMedia) {
             $foldersMedia = Document::getChildrenOf($rootfolderMedia->getId(), 'Folder');
         }
         foreach ($folders as $folder) {
             $userFolders[$folder->getLabel()] = $folder->getId();
         }
         foreach ($foldersMedia as $folder) {
             $mediaFolders[$folder->getLabel()] = $folder->getId();
         }
         $title = @str_replace($search, $replace, $firstname);
         $title = trim(@str_replace('  ', ' ', $title));
         $title = mb_strtoupper($title);
         $firstLetter = mb_substr($title, 0, 1);
         if (array_key_exists($firstLetter, $userFolders)) {
             $alphaFolder = Document::getDocumentInstance($userFolders[$firstLetter]);
         }
         if (array_key_exists($firstLetter, $mediaFolders)) {
             $mediaAlphaFolder = Document::getDocumentInstance($mediaFolders[$firstLetter]);
         }
         if (!$alphaFolder) {
             $alphaFolder = new Folder();
             $alphaFolder->setLabel($firstLetter);
             $alphaFolder->save(null, $rootfolderUser);
         }
         if (!$mediaAlphaFolder) {
             $mediaAlphaFolder = new Folder();
             $mediaAlphaFolder->setLabel($firstLetter);
             $mediaAlphaFolder->save(null, $rootfolderMedia);
         }
         ////////////////////////////////////////
         if ($this->type == "user") {
             if ($this->media) {
                 $this->user->setCv($this->media->getId());
             }
             $this->user->setEducation($education);
             $jobtypes = "";
             foreach ($job_types as $jt) {
                 $jobtypes .= "|";
                 $jobtypes .= $jt;
             }
             $this->user->setJobType($jobtypes);
             $saved = $this->user->save(null, $alphaFolder);
         } elseif ($this->type == "company") {
             if (!$this->company) {
                 $this->company = new Company();
             }
             $company_folder = Document::getDocumentByExclusiveTag("company_folder_" . $accountType);
             $this->company->setLabel($label);
             $this->company->setAccountType($accountType);
             $this->company->setDescription($description);
             $this->company->setCountry($country);
             $this->company->setCity($city);
             $this->company->setAddress($address);
             $this->company->setZip($xip);
             $this->company->setWeb($web);
开发者ID:kotow,项目名称:work,代码行数:67,代码来源:actions.class.php

示例8: testQuoting

 public function testQuoting()
 {
     $this->assertEmpty(Folder::model()->findByPk("'"));
     $this->assertEmpty(Folder::model()->ancestorsOf("'")->findAll());
     $this->assertEmpty(Folder::model()->childrenOf("'")->findAll());
     $this->assertEmpty(Folder::model()->parentOf("'")->findAll());
     $this->assertEmpty(Folder::model()->deleteNode("'"));
     $this->assertEmpty(Folder::model()->descendantsOf("'")->findAll());
     $this->assertEmpty(Folder::model()->fullPathOf("'")->findAll());
     $this->assertEmpty(Folder::model()->pathOf("'")->findAll());
     $this->assertEmpty(Folder::model()->unorderedPathOf("'")->findAll());
     /** @var Folder $folder5 */
     $folder5 = Folder::model()->findByPk(5);
     try {
         $folder5->moveTo("'");
         $this->fail();
     } catch (CDbException $e) {
         $this->assertEquals(201, $e->getCode());
     }
     $newFolder = new Folder();
     $newFolder->name = 'Folder';
     $this->assertTrue($newFolder->save());
     $this->assertEquals(1, $newFolder->appendTo("'"));
     try {
         Folder::model()->markAsRoot("'");
         $this->fail();
     } catch (CDbException $e) {
         // http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
         $this->assertEquals('1452', $e->errorInfo[1]);
     }
 }
开发者ID:aidask,项目名称:yii-closure-table-behavior,代码行数:31,代码来源:ClosureTableBehaviorTest.php

示例9: saveFolder

 private function saveFolder(\Request $request)
 {
     $folder_id = $request->getVar('folder_id');
     if ($folder_id) {
         $folder = new Folder($folder_id);
     } else {
         $folder = new Folder();
         $folder->setFtype($request->getVar('ftype'));
     }
     $folder->setTitle($request->getVar('title'));
     if (empty($folder->title)) {
         $this->sendErrorHeader('<div class="alert alert-danger"><i class="fa fa-times fa-lg"></i> May not use an empty folder name.</div>');
         return;
     }
     $db = \Database::newDB();
     $db->addTable('folders')->addFieldConditional('title', $folder->title);
     $result = $db->selectOneRow();
     // if a duplicate row is found (with a different id) then force an error
     if (!empty($result) && $result['id'] != $folder_id) {
         $this->sendErrorHeader('<div class="alert alert-danger"><i class="fa fa-times fa-lg"></i> A folder with this name already exists</div>');
     } else {
         $folder->save();
         echo $folder->id;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:25,代码来源:FC_Forms.php

示例10: InitData

function InitData($project_name)
{
    $listPageType = 'list_types';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $listPageType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'list_type'...\n";
        $newList = new Lists();
        $newList->setLabel('List Types');
        $newList->setListid($listPageType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('System list');
        $newItem->setValue('system');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Static list');
        $newItem->setValue('static');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Editable list');
        $newItem->setValue('editable');
        $newItem->save(null, $newList);
    }
    $listPageType = 'page_types';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $listPageType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'page_types'...\n";
        $newList = new Lists();
        $newList->setLabel('Page Types');
        $newList->setListid($listPageType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('Content page');
        $newItem->setValue('CONTENT');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Page reference');
        $newItem->setValue('REFERENCE');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('External page');
        $newItem->setValue('EXTERNAL');
        $newItem->save(null, $newList);
    }
    $cultureType = 'culture';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $cultureType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'culture'...\n";
        $newList = new Lists();
        $newList->setLabel('Culture');
        $newList->setListid($cultureType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('english');
        $newItem->setValue('en');
        $newItem->save(null, $newList);
        /*		$newItem = new Listitem();
        		$newItem->setLabel('български');
        		$newItem->setValue('bg');
        		$newItem->save(null, $newList);*/
    }
    $userType = 'usertype';
    $c = new Criteria();
    $c->add(ListsPeer::LIST_ID, $userType);
    $listExist = ListsPeer::doSelectOne($c);
    if (!$listExist) {
        echo "Creating list 'user types'...\n";
        $newList = new Lists();
        $newList->setLabel('User Types');
        $newList->setListid($userType);
        $newList->setListtype('system');
        $newList->save();
        $newItem = new Listitem();
        $newItem->setLabel('Administrator (all rights)');
        $newItem->setValue('admin');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Editor (no access to administration modules)');
        $newItem->setValue('editor');
        $newItem->save(null, $newList);
        $newItem = new Listitem();
        $newItem->setLabel('Editor (edit and save existing items)');
        $newItem->setValue('restricted_editor');
        $newItem->save(null, $newList);
    }
    $Mailinglist_Folder = Document::getDocumentByExclusiveTag('newsletter_folder_mailinglist');
    if (!$Mailinglist_Folder) {
        $Newsletter_Root = Rootfolder::getRootfolderByModule('Newsletter');
        $Mailinglist_Folder = new Folder();
        $Mailinglist_Folder->setLabel('Mailing lists');
        $Mailinglist_Folder->save(null, $Newsletter_Root);
//.........这里部分代码省略.........
开发者ID:kotow,项目名称:work,代码行数:101,代码来源:init_data.php

示例11: addFolder

 public function addFolder()
 {
     $parent = $this->getRequestParam('parent_id', NULL);
     $name = $this->getRequestParam('name', '');
     $response = new AjaxResponse();
     if ($parent >= 0 && !empty($name)) {
         try {
             $folder = new Folder();
             $folder->name = $name;
             $folder->parent = Folder::find('_id', $parent);
             $folder->save();
             $response->success = true;
             $response->message = System::getLanguage()->_('SuccessAddFolder');
             $response->data = $folder->toJSON();
         } catch (InvalidFolderNameException $e) {
             $response->success = false;
             $response->message = System::getLanguage()->_('ErrorInvalidFolderName');
         } catch (FolderAlreadyExistsException $e) {
             $response->success = false;
             $response->message = System::getLanguage()->_('ErrorFolderAlreadyExists');
         } catch (Exception $e) {
             $response->success = false;
             $response->message = System::getLanguage()->_('ErrorInvalidParameter');
         }
     } else {
         if (empty($name)) {
             $response->success = false;
             $response->message = System::getLanguage()->_('ErrorEmptyFolderName');
         } else {
             $response->success = false;
             $response->message = System::getLanguage()->_('ErrorInvalidParameter');
         }
     }
     $response->send();
 }
开发者ID:nicefirework,项目名称:sharecloud,代码行数:35,代码来源:ApiController.class.php


注:本文中的Folder::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。