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


PHP WikiPage::setProjectIndex方法代码示例

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


在下文中一共展示了WikiPage::setProjectIndex方法的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: 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
     //Here we will edit a wiki page
     $preview = false;
     $data = array_var($_POST, 'wiki', false);
     if (false !== $data) {
         $preview = array_key_exists('preview', $data);
     }
     if (!$preview && $data) {
         //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->setPublish(logged_user()->isMemberOfOwnerCompany() ? $data['publish'] : 0);
         $page->setParentId($data['parent_id']);
         $page->setProjectSidebar(logged_user()->isMemberOfOwnerCompany() ? $data['project_sidebar'] : 0);
         //Make a new revision of this page
         $revision = $page->makeRevision();
         // Check to see if we want to lock this page
         if (isset($data['locked'])) {
             if ($data['locked'] == 1 && $page->canLock(logged_user())) {
                 // If we want to lock this page and the user has permissions to lock it, and the page is not already locked
                 $page->setLocked(true);
                 $page->setLockedById(logged_user()->getId());
                 $page->setLockedOn(DateTimeValueLib::now());
             }
             // if
         }
         // if
         //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
     $revision = new Revision();
     if (!$data) {
         // there was no input POSTed
         $data['content'] = $revision->getContent();
     }
     $data['preview_content'] = do_textile($data['content']);
     //Assign revision object
     tpl_assign('data', $data);
     tpl_assign('page', $page);
     tpl_assign('revision', $revision);
     tpl_assign('tags', '');
     $this->setTemplate('edit');
     $this->setSidebar(get_template_path('textile_help_sidebar'));
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:87,代码来源:WikiController.class.php

示例3: copy


//.........这里部分代码省略.........
                         $file->setIsImportant($source_file->getIsImportant());
                         $file->setIsLocked($source_file->getIsLocked());
                         $file->setIsVisible($source_file->getIsVisible());
                         $file->setExpirationTime($source_file->getExpirationTime());
                         $file->setCommentsEnabled($source_file->getCommentsEnabled());
                         $file->setAnonymousCommentsEnabled($source_file->getAnonymousCommentsEnabled());
                         $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)) {
开发者ID:469306621,项目名称:Languages,代码行数:67,代码来源:ProjectController.class.php


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