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


PHP Versioned::get_live_stage方法代码示例

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


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

示例1: sourceRecords

 /**
  * This returns the workflow requests outstanding for this user.
  * It does one query against draft for change requests, and another
  * request against live for the deletion requests (which are not in draft
  * any more), and merges the result sets together.
  */
 function sourceRecords($params)
 {
     increase_time_limit_to(120);
     $currentStage = Versioned::current_stage();
     $changes = WorkflowTwoStepRequest::get_by_author('WorkflowPublicationRequest', Member::currentUser(), array('AwaitingApproval'));
     if ($changes) {
         foreach ($changes as $change) {
             $change->RequestType = "Publish";
         }
     }
     Versioned::reading_stage(Versioned::get_live_stage());
     $deletions = WorkflowTwoStepRequest::get_by_author('WorkflowDeletionRequest', Member::currentUser(), array('AwaitingApproval'));
     if ($deletions) {
         foreach ($deletions as $deletion) {
             $deletion->RequestType = "Deletion";
         }
     }
     if ($changes && $deletions) {
         $changes->merge($deletions);
     } else {
         if ($deletions) {
             $changes = $deletions;
         }
     }
     return $changes;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:32,代码来源:MyTwoStepWorkflowRequests.php

示例2: unpublish

 /**
  * Unpublish the selected records passed from the unpublish bulk action
  *
  * @param SS_HTTPRequest $request
  * @return SS_HTTPResponse List of published record IDs
  */
 public function unpublish(SS_HTTPRequest $request)
 {
     $ids = array();
     foreach ($this->getRecords() as $record) {
         if ($record->hasExtension('Versioned')) {
             array_push($ids, $record->ID);
             $record->deleteFromStage(Versioned::get_live_stage());
         }
     }
     $response = new SS_HTTPResponse(Convert::raw2json(array('done' => true, 'records' => $ids)));
     $response->addHeader('Content-Type', 'text/json');
     return $response;
 }
开发者ID:bummzack,项目名称:page-blocks,代码行数:19,代码来源:GridFieldBulkActionUnpublishHandler.php

示例3: versionedunlink

 /**
  * Unlink the selected records by setting the foreign key to zero
  * in both Stage and Live tables.
  *
  * @param SS_HTTPRequest $request
  * @return SS_HTTPResponse List of published record IDs
  */
 public function versionedunlink(SS_HTTPRequest $request)
 {
     $ids = $this->getRecordIDList();
     // remove the selected entries from Stage.
     $this->gridField->list->removeMany($ids);
     // Unpublish the unlinked records.
     // This is potentially destructive, but there's no other "good" way to do this.
     // When a unlinked record gets added to another page, the only way to "activate" the
     // record is to publish it.. so the published version will be overwritten anyway!
     foreach ($this->getRecords() as $record) {
         if ($record->hasExtension('Versioned')) {
             $record->deleteFromStage(Versioned::get_live_stage());
         }
     }
     $response = new SS_HTTPResponse(Convert::raw2json(array('done' => true, 'records' => $ids)));
     $response->addHeader('Content-Type', 'text/json');
     return $response;
 }
开发者ID:helpfulrobot,项目名称:bummzack-page-blocks,代码行数:25,代码来源:GridFieldBulkActionVersionedUnlinkHandler.php

示例4: onAfterDelete

 public function onAfterDelete()
 {
     $assets = $this->findAssets($this->owner);
     // When deleting from live, just secure assets
     // Note that DataObject::delete() ignores sourceQueryParams
     if ($this->isVersioned() && \Versioned::current_stage() === \Versioned::get_live_stage()) {
         $this->protectAll($assets);
         return;
     }
     // When deleting from stage then check if we should archive assets
     $archive = $this->owner->config()->archive_assets;
     if ($archive && $this->isVersioned()) {
         // Archived assets are kept protected
         $this->protectAll($assets);
     } else {
         // Otherwise remove all assets
         $this->deleteAll($assets);
     }
 }
开发者ID:biggtfish,项目名称:silverstripe-framework,代码行数:19,代码来源:AssetControlExtension.php

示例5: sourceRecords

 function sourceRecords($params)
 {
     // Set stage, otherwise, we won't get any results
     $currentStage = Versioned::current_stage();
     Versioned::reading_stage(Versioned::get_live_stage());
     $res = WorkflowThreeStepRequest::get_by_author('WorkflowDeletionRequest', Member::currentUser(), array('AwaitingApproval', 'Approved'));
     // Reset stage back to what it was
     Versioned::reading_stage($currentStage);
     // Add WFRequestedWhen column
     $doSet = new DataObjectSet();
     if ($res) {
         foreach ($res as $result) {
             if ($wf = $result->openWorkflowRequest()) {
                 $result->WFRequestedWhen = $wf->Created;
                 $doSet->push($result);
             }
         }
     }
     return $doSet;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:20,代码来源:ThreeStepMyDeletionRequestsSideReport.php

示例6: doCreate

 public function doCreate($data, $form)
 {
     if (!singleton('AdvancedReport')->canCreate()) {
         return Security::permissionFailure($this);
     }
     $data = $form->getData();
     $description = $data['Description'];
     $class = $data['ClassName'];
     if (!is_subclass_of($class, 'AdvancedReport')) {
         $form->addErrorMessage('ClassName', _t('ReportHolder.INVALID_TYPE', 'An invalid report type was selected'), 'required');
         return $this->redirectBack();
     }
     $page = new ReportPage();
     $page->update(array('Title' => $data['Title'], 'Content' => $description ? "<p>{$description}</p>" : '', 'ReportType' => $class, 'ParentID' => $this->data()->ID));
     $page->writeToStage('Stage');
     if (Versioned::current_stage() == Versioned::get_live_stage()) {
         $page->doPublish();
     }
     return $this->redirect($page->Link());
 }
开发者ID:helpfulrobot,项目名称:maldicore-advancedreports,代码行数:20,代码来源:ReportHolder.php

示例7: baseForumTable

 /**
  * A function that returns the correct base table to use for custom forum queries. It uses the getVar stage to determine
  * what stage we are looking at, and determines whether to use SiteTree or SiteTree_Live (the general case). If the stage is
  * not specified, live is assumed (general case). It is a static function so it can be used for both ForumHolder and Forum.
  *
  * @return String
  */
 static function baseForumTable()
 {
     $stage = Controller::curr()->getRequest() ? Controller::curr()->getRequest()->getVar('stage') : false;
     if (!$stage) {
         $stage = Versioned::get_live_stage();
     }
     if (class_exists('SapphireTest', false) && SapphireTest::is_running_test() || $stage == "Stage") {
         return "SiteTree";
     } else {
         return "SiteTree_Live";
     }
 }
开发者ID:nicmart,项目名称:comperio-site,代码行数:19,代码来源:ForumHolder.php

示例8: getRequestedStage

 public static function getRequestedStage()
 {
     return Input::get('stage', \Versioned::get_live_stage());
 }
开发者ID:helpfulrobot,项目名称:themonkeys-laravel-silverstripe,代码行数:4,代码来源:Silverstripe.php

示例9: onAfterWrite

 /**
  * (non-PHPdoc)
  *
  * @see SiteTree::onBeforeWrite()
  */
 public function onAfterWrite()
 {
     parent::onAfterWrite();
     // Skip on publishing
     if (Versioned::get_live_stage() == Versioned::current_stage()) {
         return;
     }
     // Update the values of all fields added from editable field
     if ($this->ID && $this->many_many('Fields') && ($pageFields = $this->getEditableFields())) {
         foreach ($pageFields as $pageField) {
             // Set submitted value into the field
             $field = $pageField->getFormField();
             if (!$field) {
                 continue;
             }
             $field->setValue($this->{$pageField->Name});
             // Extra fields to be saved
             $value = $field->Value();
             $sort = $pageField->Sort;
             $group = $pageField->Group;
             // Clone the editable field object
             // Remove the current saved one
             $pageFields->remove($pageField);
             // Add the clone with the new extra data
             $pageFields->add($pageField, ['Value' => $value, 'Sort' => $sort, 'Group' => $group]);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:satrun77-configurablepage,代码行数:33,代码来源:ConfigurablePage.php


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