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


PHP Versioned::current_archived_date方法代码示例

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


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

示例1: SSCompactNavigator

 /**
  * SSCompactNavigator first checks if you are allowed to see the navigation bar, and if so, then checks
  * if third party templates have been specified. If so, it loads them, and provides them with the required
  * variables. If not, it loads the defaults instead.
  */
 public function SSCompactNavigator()
 {
     if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain')) {
         $RenderTemplate = isset(CompactNavigator::$Template) ? CompactNavigator::$Template : $this->class;
         if (isset(CompactNavigator::$CssTheme)) {
             Requirements::css(CompactNavigator::$CssTheme);
         } else {
             Requirements::css('compactnavigator/css/CompactNavigator.css');
         }
         if (isset(CompactNavigator::$JsTheme)) {
             Requirements::javascript(CompactNavigator::$JsTheme);
         } else {
             Requirements::javascript('compactnavigator/scripts/CompactNavigator.js');
         }
         if (class_exists("CMSMain")) {
             $this->owner->cmsLink = Controller::join_links(singleton("CMSMain")->Link("edit"), "show");
         }
         $this->owner->adminLink = self::$adminLink;
         if ($date = Versioned::current_archived_date()) {
             $this->owner->DisplayMode = 'Archived';
             $this->owner->ArDate = Object::create('Datetime', $date, null);
         } else {
             $this->owner->DisplayMode = Versioned::current_stage();
         }
         return $this->owner->renderWith(array($RenderTemplate, 'CompactNavigatior'));
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-compactnavigator,代码行数:32,代码来源:CompactNavigator.php

示例2: augmentSQL

 function augmentSQL(SQLQuery &$query)
 {
     // Get the content at a specific date
     if ($date = Versioned::current_archived_date()) {
         foreach ($query->from as $table => $dummy) {
             if (!isset($baseTable)) {
                 $baseTable = $table;
             }
             $query->renameTable($table, $table . '_versions');
             $query->replaceText("\"{$table}\".\"ID\"", "\"{$table}\".\"RecordID\"");
             // Add all <basetable>_versions columns
             foreach (self::$db_for_versions_table as $name => $type) {
                 $query->select[] = sprintf('"%s_versions"."%s"', $baseTable, $name);
             }
             $query->select[] = sprintf('"%s_versions"."%s" AS "ID"', $baseTable, 'RecordID');
             if ($table != $baseTable) {
                 $query->from[$table] .= " AND \"{$table}_versions\".\"Version\" = \"{$baseTable}_versions\".\"Version\"";
             }
         }
         // Link to the version archived on that date
         $archiveTable = $this->requireArchiveTempTable($baseTable, $date);
         $query->from[$archiveTable] = "INNER JOIN \"{$archiveTable}\"\n\t\t\t\tON \"{$archiveTable}\".\"ID\" = \"{$baseTable}_versions\".\"RecordID\" \n\t\t\t\tAND \"{$archiveTable}\".\"Version\" = \"{$baseTable}_versions\".\"Version\"";
         // Get a specific stage
     } else {
         if (Versioned::current_stage() && Versioned::current_stage() != $this->defaultStage && array_search(Versioned::current_stage(), $this->stages) !== false) {
             foreach ($query->from as $table => $dummy) {
                 $query->renameTable($table, $table . '_' . Versioned::current_stage());
             }
         }
     }
 }
开发者ID:comperio,项目名称:silverstripe-framework,代码行数:31,代码来源:Versioned.php

示例3: script

 public function script()
 {
     // we don't allow access unless the user is logged in
     if (!Member::currentUserID()) {
         return;
     }
     $type = $this->request->param('ID');
     $filename = $this->request->param('OtherID');
     $content = $this->scriptService->generateScriptDataFor($type, $filename, Versioned::current_archived_date());
     $this->response->addHeader('Content-type', 'text/javascript');
     return $content;
 }
开发者ID:Marketo,项目名称:SilverStripe-Script-Genie,代码行数:12,代码来源:ScriptGenieController.php

示例4: getMessage

 public function getMessage()
 {
     if ($date = Versioned::current_archived_date()) {
         $dateObj = DBField::create_field('Datetime', $date);
         return "<div id=\"SilverStripeNavigatorMessage\" title=\"" . _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') . "\">" . _t('ContentController.ARCHIVEDSITEFROM', 'Archived site from') . "<br>" . $dateObj->Nice() . "</div>";
     }
 }
开发者ID:helpfulrobot,项目名称:comperio-silverstripe-cms,代码行数:7,代码来源:SilverStripeNavigator.php

示例5: getLink

 function getLink($page)
 {
     if ($date = Versioned::current_archived_date()) {
         return $page->AbsoluteLink() . '?archiveDate=' . $date;
     }
 }
开发者ID:rixrix,项目名称:silverstripe-cms,代码行数:6,代码来源:SilverStripeNavigatorItem.php

示例6: SilverStripeNavigator

    public function SilverStripeNavigator()
    {
        $member = Member::currentUser();
        $items = '';
        $message = '';
        if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
            if ($this->dataRecord) {
                Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css');
                Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
                Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
                Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-livequery/jquery.livequery.js');
                Requirements::javascript(SAPPHIRE_DIR . '/javascript/SilverStripeNavigator.js');
                $return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord);
                $items = $return['items'];
                $message = $return['message'];
            }
            if ($member) {
                $firstname = Convert::raw2xml($member->FirstName);
                $surname = Convert::raw2xml($member->Surname);
                $logInMessage = _t('ContentController.LOGGEDINAS', 'Logged in as') . " {$firstname} {$surname} - <a href=\"Security/logout\">" . _t('ContentController.LOGOUT', 'Log out') . "</a>";
            } else {
                $logInMessage = _t('ContentController.NOTLOGGEDIN', 'Not logged in') . " - <a href=\"Security/login\">" . _t('ContentController.LOGIN', 'Login') . "</a>";
            }
            $viewPageIn = _t('ContentController.VIEWPAGEIN', 'View Page in:');
            return <<<HTML
\t\t\t\t<div id="SilverStripeNavigator">
\t\t\t\t\t<div class="holder">
\t\t\t\t\t<div id="logInStatus">
\t\t\t\t\t\t{$logInMessage}
\t\t\t\t\t</div>

\t\t\t\t\t<div id="switchView" class="bottomTabs">
\t\t\t\t\t\t<div class="blank">{$viewPageIn} </div>
\t\t\t\t\t\t{$items}
\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t\t{$message}
HTML;
            // On live sites we should still see the archived message
        } else {
            if ($date = Versioned::current_archived_date()) {
                Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css');
                $dateObj = Object::create('Datetime', $date, null);
                // $dateObj->setVal($date);
                return "<div id=\"SilverStripeNavigatorMessage\">" . _t('ContentController.ARCHIVEDSITEFROM') . "<br>" . $dateObj->Nice() . "</div>";
            }
        }
    }
开发者ID:hamishcampbell,项目名称:silverstripe-sapphire,代码行数:49,代码来源:ContentController.php

示例7: isActive

 function isActive()
 {
     return Versioned::current_archived_date();
 }
开发者ID:nzjoel,项目名称:silverstripe-cms,代码行数:4,代码来源:SilverStripeNavigator.php

示例8: SilverStripeNavigator

	public function SilverStripeNavigator() {
		$member = Member::currentUser();

		if(Director::isDev() || Permission::check('CMS_ACCESS_CMSMain')) {
			Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css');

			Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
			// Requirements::javascript(THIRDPARTY_DIR . '/prototype.js');
			Requirements::customScript(<<<JS
				Behaviour.register({
					'#switchView a' :  {
						onclick : function() {
							var w = window.open(this.href,windowName(this.target));
							w.focus();
							return false;
						}
					}
				});

				function windowName(suffix) {
					var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
					return base + suffix;
				}
				window.name = windowName('site');
JS
			);

			if($this->dataRecord){
				$thisPage = $this->dataRecord->Link();
				$cmsLink = 'admin/show/' . $this->dataRecord->ID;
				$cmsLink = "<a href=\"$cmsLink\" target=\"cms\">". _t('ContentController.CMS', 'CMS') ."</a>";
			} else {
				/**
				 * HGS: If this variable is missing a notice is raised. Subclasses of ContentController
				 * are required to implement RelativeLink anyway, so this should work even if the
				 * dataRecord isn't set.
				 */
				$thisPage = $this->Link();
				$cmsLink = '';
			}

			$archiveLink = "";

			if($date = Versioned::current_archived_date()) {
				$dateObj = Object::create('Datetime', $date, null);
				// $dateObj->setVal($date);

				$archiveLink = "<a class=\"current\">". _t('ContentController.ARCHIVEDSITE', 'Archived Site') ."</a>";
				$liveLink = "<a href=\"$thisPage?stage=Live\" target=\"site\" style=\"left : -3px;\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</a>";
				$stageLink = "<a href=\"$thisPage?stage=Stage\" target=\"site\" style=\"left : -1px;\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</a>";
				$message = "<div id=\"SilverStripeNavigatorMessage\" title='". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message won\'t be shown to your visitors') ."'>". _t('ContentController.ARCHIVEDSITEFROM', 'Archived site from') ."<br>" . $dateObj->Nice() . "</div>";

			} else if(Versioned::current_stage() == 'Stage') {
				$stageLink = "<a class=\"current\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</a>";
				$liveLink = "<a href=\"$thisPage?stage=Live\" target=\"site\" style=\"left : -3px;\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</a>";
				$message = "<div id=\"SilverStripeNavigatorMessage\" title='". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message won\'t be shown to your visitors') ."'>".  _t('ContentController.DRAFTSITE', 'Draft Site') ."</div>";

			} else {
				$liveLink = "<a class=\"current\">". _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</a>";
				$stageLink = "<a href=\"$thisPage?stage=Stage\" target=\"site\" style=\"left : -1px;\">". _t('ContentController.DRAFTSITE', 'Draft Site') ."</a>";
				$message = "<div id=\"SilverStripeNavigatorMessage\" title='". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message won\'t be shown to your visitors') ."'>".  _t('ContentController.PUBLISHEDSITE', 'Published Site') ."</div>";
			}

			if($member) {
				$firstname = Convert::raw2xml($member->FirstName);
				$surname = Convert::raw2xml($member->Surame);
				$logInMessage = _t('ContentController.LOGGEDINAS', 'Logged in as') ." {$firstname} {$surname} - <a href=\"Security/logout\">". _t('ContentController.LOGOUT', 'Log out'). "</a>";
			} else {
				$logInMessage = _t('ContentController.NOTLOGGEDIN', 'Not logged in') ." - <a href='Security/login'>". _t('ContentController.LOGIN', 'Login') ."</a>";
			}
			$viewPageIn = _t('ContentController.VIEWPAGEIN', 'View Page in:');
			/**
			 * HGS: cmsLink is now only set if there is a dataRecord. You can't view the page in the
			 * CMS if there is no dataRecord
			 */
			return <<<HTML
				<div id="SilverStripeNavigator">
					<div class="holder">
					<div id="logInStatus">
						$logInMessage
					</div>

					<div id="switchView" class="bottomTabs">
						<div class="blank">$viewPageIn </div>
						$cmsLink
						$stageLink
						<div class="blank" style="width:1em;"> </div>
						$liveLink
						$archiveLink
					</div>
					</div>
				</div>
					$message
HTML;

		// On live sites we should still see the archived message
		} else {
			if($date = Versioned::current_archived_date()) {
				Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css');
				$dateObj = Object::create('Datetime', $date, null);
//.........这里部分代码省略.........
开发者ID:neopba,项目名称:silverstripe-book,代码行数:101,代码来源:ContentController.php

示例9: SilverStripeNavigator

    public function SilverStripeNavigator()
    {
        $member = Member::currentUser();
        if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain')) {
            Requirements::css('sapphire/css/SilverStripeNavigator.css');
            Requirements::javascript('jsparty/behaviour.js');
            // Requirements::javascript('jsparty/prototype.js');
            Requirements::customScript(<<<JS
\t\t\t\tBehaviour.register({
\t\t\t\t\t'#switchView a' :  {
\t\t\t\t\t\tonclick : function() {
\t\t\t\t\t\t\tvar w = window.open(this.href,windowName(this.target));
\t\t\t\t\t\t\tw.focus();
\t\t\t\t\t\t\treturn false;
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t});

\t\t\t\tfunction windowName(suffix) {
\t\t\t\t\tvar base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\\//g,'_').replace(/\\./g,'_');
\t\t\t\t\treturn base + suffix;
\t\t\t\t}
\t\t\t\twindow.name = windowName('site');
JS
);
            if ($this->dataRecord) {
                $thisPage = $this->dataRecord->Link();
                $cmsLink = 'admin/show/' . $this->dataRecord->ID;
                $cmsLink = "<a href=\"{$cmsLink}\" target=\"cms\">CMS</a>";
            } else {
                /**
                 * HGS: If this variable is missing a notice is raised. Subclasses of ContentController
                 * are required to implement RelativeLink anyway, so this should work even if the
                 * dataRecord isn't set.
                 */
                $thisPage = $this->Link();
                $cmsLink = '';
            }
            $archiveLink = "";
            if ($date = Versioned::current_archived_date()) {
                $dateObj = Object::create('Datetime', $date, null);
                // $dateObj->setVal($date);
                $archiveLink = "<a class=\"current\">Archived Site</a>";
                $liveLink = "<a href=\"{$thisPage}?stage=Live\" target=\"site\" style=\"left : -3px;\">Published Site</a>";
                $stageLink = "<a href=\"{$thisPage}?stage=Stage\" target=\"site\" style=\"left : -1px;\">Draft Site</a>";
                $message = "<div id=\"SilverStripeNavigatorMessage\" title=\"Note: this message won't be shown to your visitors\">Archived site from<br>" . $dateObj->Nice() . "</div>";
            } else {
                if (Versioned::current_stage() == 'Stage') {
                    $stageLink = "<a class=\"current\">Draft Site</a>";
                    $liveLink = "<a href=\"{$thisPage}?stage=Live\" target=\"site\" style=\"left : -3px;\">Published Site</a>";
                    $message = "<div id=\"SilverStripeNavigatorMessage\" title=\"Note: this message won't be shown to your visitors\">DRAFT SITE</div>";
                } else {
                    $liveLink = "<a class=\"current\">Published Site</a>";
                    $stageLink = "<a href=\"{$thisPage}?stage=Stage\" target=\"site\" style=\"left : -1px;\">Draft Site</a>";
                    $message = "<div id=\"SilverStripeNavigatorMessage\" title=\"Note: this message won't be shown to your visitors\">PUBLISHED SITE</div>";
                }
            }
            if ($member) {
                $firstname = Convert::raw2xml($member->FirstName);
                $surname = Convert::raw2xml($member->Surame);
                $logInMessage = "Logged in as {$firstname} {$surname} - <a href=\"Security/logout\">log out</a>";
            } else {
                $logInMessage = "Not logged in - <a href=\"Security/login\">log in</a>";
            }
            /**
             * HGS: cmsLink is now only set if there is a dataRecord. You can't view the page in the
             * CMS if there is no dataRecord
             */
            return <<<HTML
\t\t\t\t<div id="SilverStripeNavigator">
\t\t\t\t\t<div class="holder">
\t\t\t\t\t<div id="logInStatus">
\t\t\t\t\t\t{$logInMessage}
\t\t\t\t\t</div>

\t\t\t\t\t<div id="switchView" class="bottomTabs">
\t\t\t\t\t\t<div class="blank"> View page in: </div>
\t\t\t\t\t\t{$cmsLink}
\t\t\t\t\t\t{$stageLink}
\t\t\t\t\t\t<div class="blank" style="width:1em;"> </div>
\t\t\t\t\t\t{$liveLink}
\t\t\t\t\t\t{$archiveLink}
\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t\t{$message}
HTML;
            // On live sites we should still see the archived message
        } else {
            if ($date = Versioned::current_archived_date()) {
                Requirements::css('sapphire/css/SilverStripeNavigator.css');
                $dateObj = Object::create('Datetime', $date, null);
                // $dateObj->setVal($date);
                return "<div id=\"SilverStripeNavigatorMessage\">Archived site from<br>" . $dateObj->Nice() . "</div>";
            }
        }
    }
开发者ID:ramziammar,项目名称:websites,代码行数:97,代码来源:ContentController.php


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