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


PHP WikiPage::makeRevision方法代码示例

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


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

示例1: add

 /**
  * Add a wiki page
  *
  * @return void
  */
 function add()
 {
     if (!WikiPage::canAdd(logged_user(), active_project())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('wiki');
     }
     //if
     if (false !== ($data = array_var($_POST, 'wiki', false))) {
         //Make a new wiki page
         $page = new WikiPage();
         //Set the Id for this project
         $page->setProjectId(active_project()->getId());
         $page->setProjectIndex(logged_user()->isMemberOfOwnerCompany() ? $data['project_index'] : 0);
         $page->setProjectSidebar(logged_user()->isMemberOfOwnerCompany() ? $data['project_sidebar'] : 0);
         //Make a new revision of this page
         $revision = $page->makeRevision();
         //Set attributes from form
         $revision->setFromAttributes($data);
         //Set user ID and project ID
         $revision->setCreatedbyId(logged_user()->getId());
         try {
             //Start the db transaction
             DB::beginWork();
             //Save the page
             $page->save();
             //Make a log entry
             ApplicationLogs::createLog($page, active_project(), ApplicationLogs::ACTION_ADD);
             if (plugin_active('tags')) {
                 //Add page tags
                 $page->setTagsFromCSV($data['tags']);
             }
             //Commit changed
             DB::commit();
             //Tell the user they made a page
             flash_success(lang('success add wiki page'));
             //Redirect
             $this->redirectToUrl($page->getViewUrl());
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
         }
         //try
     }
     // if
     if (!isset($page) || !instance_of($page, 'WikiPage')) {
         $page = new WikiPage();
         $page->setProjectId(active_project()->getId());
     }
     // if
     tpl_assign('page', $page);
     tpl_assign('revision', new Revision());
     $this->setTemplate('edit');
 }
开发者ID:469306621,项目名称:Languages,代码行数:58,代码来源:WikiController.class.php

示例2: WikiPage

 /**
  * View all wiki pages
  * 
  * @return void
  */
 function all_pages()
 {
     // There isn't a wiki page for all pages
     // So prepare a dummy page
     $page = new WikiPage();
     // Make a revision for the page
     $revision = $page->makeRevision();
     $revision->setName(lang('wiki all pages'));
     $all_pages = Wiki::getAllProjectPages(active_project());
     tpl_assign('all_pages', $all_pages);
     tpl_assign('page', $page);
     tpl_assign('revision', $revision);
     $this->_load_sidebar();
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:19,代码来源:WikiController.class.php

示例3: copy


//.........这里部分代码省略.........
                         $file->save();
                         $source_revision = $source_file->getLastRevision();
                         if ($source_revision instanceof ProjectFileRevision) {
                             $revision = new ProjectFileRevision();
                             $revision->setFileId($file->getId());
                             $revision->setRevisionNumber($source_revision->getRevisionNumber());
                             $revision->setRepositoryId($source_revision->getRepositoryId());
                             $revision->setFilesize($source_revision->getFilesize());
                             $revision->setFilename($source_revision->getFileName());
                             $revision->setTypeString($source_revision->getTypeString());
                             $revision->setThumbFilename($source_revision->getThumbFilename());
                             $revision->setFileTypeId($source_revision->getFileTypeId());
                             $revision->setComment($source_revision->getComment());
                             $revision->save();
                         }
                     }
                     // foreach
                 }
                 // if
             }
             // if
             if ($copy_pages) {
                 $source_pages = Wiki::getAllProjectPages($source);
                 if (is_array($source_pages)) {
                     foreach ($source_pages as $source_page) {
                         $page = new WikiPage();
                         $page->setProjectId($project_id);
                         $page->setProjectIndex($source_page->getProjectIndex());
                         $page->setProjectSidebar($source_page->getProjectSidebar());
                         if (plugin_active('tags')) {
                             //$page->setTags($source_page->getTagNames());
                         }
                         //Make a new revision of this page
                         $revision = $page->makeRevision();
                         $source_revision = $source_page->getLatestRevision();
                         //Set attributes
                         $revision->setName($source_revision->getName());
                         $revision->setContent($source_revision->getContent());
                         $revision->setLogMessage($source_revision->getLogMessage());
                         //Save the page
                         $page->save();
                     }
                     // foreach
                 }
                 // if
             }
             // if
             if ($copy_users) {
                 $source_companies = ProjectCompanies::instance()->getCompaniesByProject($source);
                 if (is_array($source_companies)) {
                     foreach ($source_companies as $source_company) {
                         $project_company = new ProjectCompany();
                         $project_company->setCompanyId($source_company->getId());
                         $project_company->setProjectId($project_id);
                         $project_company->save();
                     }
                     // foreach
                 }
                 $source_users = ProjectUsers::instance()->getUsersByProject($source);
                 if (is_array($source_users)) {
                     foreach ($source_users as $source_user) {
                         $project_user = new ProjectUser();
                         $project_user->setUserId($source_user->getId());
                         $project_user->setProjectId($project_id);
                         $project_user->save();
                     }
开发者ID:469306621,项目名称:Languages,代码行数:67,代码来源:ProjectController.class.php


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