本文整理汇总了PHP中Page::getCurrentPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::getCurrentPage方法的具体用法?PHP Page::getCurrentPage怎么用?PHP Page::getCurrentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::getCurrentPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_start
public function on_start()
{
$method = $_SERVER['REQUEST_METHOD'];
$request = split("/", substr(@$_SERVER['PATH_INFO'], 1));
$this->city = new City($this->c);
// TODO: This is a pseudo-router. On 5.7 upgrade, replace with symfony
switch ($method) {
case 'POST':
// Publish
// Publish
case 'PUT':
// Save
break;
case 'GET':
// Retrieve the page's json
if ($_GET['format'] === 'json') {
echo $this->getJson();
exit;
}
break;
case 'DELETE':
// 'unpublish' the event (true deletes done through dashboard controller, not city)
$c = Page::getCurrentPage();
$c->setAttribute('exclude_page_list', true);
break;
}
}
示例2: on_start
public function on_start()
{
$c = Page::getByPath('/dashboard/blocks/stacks');
$cp = new Permissions($c);
if ($cp->canViewPage()) {
$c = Page::getCurrentPage();
$pcp = new Permissions($c);
if (!$pcp->canViewPageVersions() || $_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare') {
$cID = $c->getCollectionID();
$this->redirect('/dashboard/blocks/stacks', 'view_details', $cID);
} else {
$this->theme = 'dashboard';
}
} else {
global $c;
// ugh
$v = View::getInstance();
$c = new Page();
$c->loadError(COLLECTION_NOT_FOUND);
$v->setCollectionObject($c);
$this->c = $c;
$cont = Loader::controller("/page_not_found");
$v->setController($cont);
$v->render('/page_not_found');
}
}
示例3: view
public function view()
{
$c = \Page::getCurrentPage();
if ($this->entryMode == 'A') {
$ak = CollectionKey::getByHandle($this->exEntryAttributeKeyHandle);
if (is_object($ak)) {
$settings = $ak->getAttributeKeySettings();
$value = $c->getAttribute($ak);
if (is_object($settings)) {
$this->set('entity', $settings->getEntity());
}
if (is_object($value)) {
$this->set('entry', $value->getSelectedEntries()[0]);
}
}
} else {
$entity = $this->entityManager->find('Concrete\\Core\\Entity\\Express\\Entity', $this->exEntityID);
if (is_object($entity)) {
$this->set('entity', $entity);
if ($this->entryMode == 'S' && $this->exSpecificEntryID) {
$this->set('entry', Express::getEntry($this->exSpecificEntryID));
}
}
}
$form = $this->entityManager->find('Concrete\\Core\\Entity\\Express\\Form', $this->exFormID);
$renderer = $this->app->make('Concrete\\Core\\Express\\Form\\StandardViewRenderer', ['form' => $form]);
$this->set('renderer', $renderer);
}
示例4: __construct
function __construct($obj = NULL)
{
parent::__construct($obj);
$c = Page::getCurrentPage();
if (is_object($c)) {
$this->cID = $c->getCollectionID();
}
if ($this->bID) {
$db = Loader::db();
$v = array($this->bID);
$q = "select optionID, optionName, displayOrder from btSurveyOptions where bID = ? order by displayOrder asc";
$r = $db->query($q, $v);
$this->options = array();
if ($r) {
while ($row = $r->fetchRow()) {
$opt = new BlockPollOption();
$opt->optionID = $row['optionID'];
$opt->cID = $this->cID;
$opt->optionName = $row['optionName'];
$opt->displayOrder = $row['displayOrder'];
$this->options[] = $opt;
}
}
}
}
示例5: setPermissionObject
public function setPermissionObject(Block $b)
{
$this->permissionObject = $b;
// if the area overrides the collection permissions explicitly (with a one on the override column) we check
if ($b->overrideAreaPermissions()) {
$this->permissionObjectToCheck = $b;
} else {
$a = $b->getBlockAreaObject();
if (is_object($a)) {
if ($a->overrideCollectionPermissions()) {
$this->permissionObjectToCheck = $a;
} elseif ($a->getAreaCollectionInheritID()) {
$mcID = $a->getAreaCollectionInheritID();
$mc = Page::getByID($mcID, 'RECENT');
$ma = Area::get($mc, $a->getAreaHandle());
if ($ma->overrideCollectionPermissions()) {
$this->permissionObjectToCheck = $ma;
} else {
$this->permissionObjectToCheck = $ma->getAreaCollectionObject();
}
} else {
$this->permissionObjectToCheck = $a->getAreaCollectionObject();
}
} else {
$this->permissionObjectToCheck = Page::getCurrentPage();
}
}
}
示例6: view
function view()
{
$nextPage = $this->getNextCollection();
$previousPage = $this->getPreviousCollection();
$parentPage = Page::getByID(Page::getCurrentPage()->getCollectionParentID());
if ($this->linkStyle == 'page_name') {
$nextLinkText = !$nextPage ? '' : $nextPage->getCollectionName();
$previousLinkText = !$previousPage ? '' : $previousPage->getCollectionName();
$parentLinkText = !$parentPage ? '' : $parentPage->getCollectionName();
} else {
$nextLinkText = $this->nextLabel;
$previousLinkText = $this->previousLabel;
$parentLinkText = $this->parentLabel;
}
if ($this->showArrows) {
$nextLinkText = $nextLinkText . ' »';
$previousLinkText = '« ' . $previousLinkText;
}
$this->set('nextCollection', $nextPage);
$this->set('previousCollection', $previousPage);
$this->set('parentCollection', $parentPage);
$this->set('nextLinkText', $nextLinkText);
$this->set('previousLinkText', $previousLinkText);
$this->set('parentLinkText', $parentLinkText);
}
示例7: action
public function action($action)
{
$a = func_get_args();
$c = \Page::getCurrentPage();
array_unshift($a, $c);
return call_user_func_array(array('\\URL', 'to'), $a);
}
示例8: view
public function view()
{
$uh = Loader::helper('concrete/urls');
$bt = BlockType::getByHandle('switch_language');
Loader::model('section', 'multilingual');
$ml = MultilingualSection::getList();
$c = Page::getCurrentPage();
$al = MultilingualSection::getBySectionOfSite($c);
$languages = array();
$locale = ACTIVE_LOCALE;
if (is_object($al)) {
$locale = $al->getLanguage();
}
foreach ($ml as $m) {
$languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : '');
}
$this->set('languages', $languages);
$this->set('languageSections', $ml);
$this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch');
if (is_object($al)) {
$this->set('activeLanguage', $al->getCollectionID());
}
$pkg = Package::getByHandle('multilingual');
$mdl = Loader::helper('default_language', 'multilingual');
$this->set('defaultLanguage', $mdl->getSessionDefaultLocale());
$this->set('cID', $c->getCollectionID());
}
示例9: getContent
/**
* @return mixed AttributeValue
*/
public function getContent()
{
$c = \Page::getCurrentPage();
$content = "";
switch ($this->attributeHandle) {
case "rpv_pageName":
$content = $c->getCollectionName();
break;
case "rpv_pageDescription":
$content = $c->getCollectionDescription();
break;
case "rpv_pageDateCreated":
$content = $c->getCollectionDateAdded();
break;
case "rpv_pageDateLastModified":
$content = $c->getCollectionDateLastModified();
break;
case "rpv_pageDatePublic":
$content = $c->getCollectionDatePublic();
break;
default:
$content = $c->getAttribute($this->attributeHandle);
if (is_object($content) && get_class($content) === 'File') {
$im = Loader::helper('image');
$thumb = $im->getThumbnail($content, $this->thumbnailWidth, $this->thumbnailHeight);
//<-- set these 2 numbers to max width and height of thumbnails
$content = "<img src=\"{$thumb->src}\" width=\"{$thumb->width}\" height=\"{$thumb->height}\" alt=\"\" />";
}
break;
}
if (!strlen($content) && $c->isMasterCollection()) {
$content = $this->getPlaceHolderText($this->attributeHandle);
}
return $content;
}
示例10: view
function view(){
$c = Page::getCurrentPage();
$this->set('title', $this->title);
$this->set('buttonText', $this->buttonText);
$this->set('baseSearchPath', $this->baseSearchPath);
//auto target is the form action that is used if none is explicity set by the user
$autoTarget= $c->getCollectionPath();
/*
* This code is weird. I don't know why it's here or what it does
if( is_array($_REQUEST['search_paths']) ){
foreach($_REQUEST['search_paths'] as $search_path){
$autoTarget=str_replace('search_paths[]='.$search_path,'',$autoTarget);
$autoTarget=str_replace('search_paths%5B%5D='.$search_path,'',$autoTarget);
}
}
$autoTarget=str_replace('page='.$_REQUEST['page'],'',$autoTarget);
$autoTarget=str_replace('submit='.$_REQUEST['submit'],'',$autoTarget);
$autoTarget=str_replace(array('&&&&','&&&','&&'),'',$autoTarget);
*/
$resultTargetURL = ($this->resultsURL != '') ? $this->resultsURL : $autoTarget;
$this->set('resultTargetURL', $resultTargetURL);
//run query if display results elsewhere not set, or the cID of this page is set
if( !empty($_REQUEST['query']) || isset($_REQUEST['akID'])) {
$this->do_search();
}
}
示例11: view
public function view()
{
$ak = $this->loadAttribute();
if ($this->displayMode == "cloud") {
$type = $ak->getAttributeType();
$controller = $type->getController();
$controller->setAttributeKey($ak);
$items = $controller->getOptions();
$options = new SelectAttributeTypeOptionList();
if ($this->cloudCount > 0 && $items instanceof SelectAttributeTypeOptionList && $items->count()) {
$i = 1;
foreach ($items as $item) {
$options->add($item);
if ($i >= $this->cloudCount) {
break;
}
$i++;
}
} else {
$options = $items;
}
} else {
$c = Page::getCurrentPage();
$av = $c->getAttributeValueObject($ak);
$controller = $ak->getController();
$options = $c->getAttribute($ak->getAttributeKeyHandle());
}
if ($this->targetCID > 0) {
$target = Page::getByID($this->targetCID);
$this->set('target', $target);
}
$this->set('options', $options);
$this->set('akc', $controller);
$this->set('ak', $ak);
}
示例12: action_post
public function action_post()
{
// happens through ajax
$pagetype = PageType::getByID($this->ptID);
if (is_object($pagetype) && $this->enablePostingFromGathering) {
$ccp = new Permissions($pagetype);
if ($ccp->canEditPageTypeInComposer()) {
$ct = PageType::getByID($this->post('ptComposerPageTypeID'));
$availablePageTypes = $pagetype->getComposerPageTypeObjects();
if (!is_object($ct) && count($availablePageTypes) == 1) {
$ct = $availablePageTypes[0];
}
$c = Page::getCurrentPage();
$e = $pagetype->validatePublishRequest($ct, $c);
$r = new PageTypePublishResponse($e);
if (!$e->has()) {
$d = $pagetype->createDraft($ct);
$d->setPageDraftTargetParentPageID($c->getCollectionID());
$d->saveForm();
$d->publish();
$nc = Page::getByID($d->getCollectionID(), 'RECENT');
$link = Core::make('helper/navigation')->getLinkToCollection($nc, true);
$r->setRedirectURL($link);
}
$r->outputJSON();
}
}
exit;
}
示例13: __construct
/**
* @param \File $f
* @param null $usePictureTag
*/
public function __construct(\File $f = null, $usePictureTag = null)
{
if (!is_object($f)) {
return false;
}
if (isset($usePictureTag)) {
$this->usePictureTag = $usePictureTag;
} else {
$this->loadPictureSettingsFromTheme();
}
if ($this->usePictureTag) {
if (!isset($this->theme)) {
$c = \Page::getCurrentPage();
$this->theme = $c->getCollectionThemeObject();
}
$sources = array();
$fallbackSrc = $f->getRelativePath();
foreach ($this->theme->getThemeResponsiveImageMap() as $thumbnail => $width) {
$type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle($thumbnail);
if ($type != NULL) {
$src = $f->getThumbnailURL($type->getBaseVersion());
$sources[] = array('src' => $src, 'width' => $width);
if ($width == 0) {
$fallbackSrc = $src;
}
}
}
$this->tag = \Concrete\Core\Html\Object\Picture::create($sources, $fallbackSrc);
} else {
// Return a simple image tag.
$this->tag = \HtmlObject\Image::create($f->getRelativePath());
$this->tag->width($f->getAttribute('width'));
$this->tag->height($f->getAttribute('height'));
}
}
示例14: on_page_view
public function on_page_view()
{
$html = Loader::helper('html');
$c = Page::getCurrentPage();
if (!$c->isEditMode()) {
$this->addFooterItem('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>');
$this->addFooterItem('<script type="text/javascript">
function googleMapInit' . $this->bID . '() {
try{
var latlng = new google.maps.LatLng(' . $this->latitude . ', ' . $this->longitude . ');
var mapOptions = {
zoom: ' . $this->zoom . ',
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
mapTypeControl: false
};
var map = new google.maps.Map(document.getElementById(\'googleMapCanvas' . $this->bID . '\'), mapOptions);
var marker = new google.maps.Marker({
position: latlng,
map: map
});
}catch(e){alert(e.message)}
}
$(function() {
googleMapInit' . $this->bID . '();
});
</script>');
}
}
示例15: getServiceLink
public function getServiceLink(Page $c = null)
{
if (!is_object($c)) {
$c = \Page::getCurrentPage();
}
if (is_object($c) && !$c->isError()) {
$url = urlencode($c->getCollectionLink(true));
switch ($this->getHandle()) {
case 'facebook':
return "https://www.facebook.com/sharer/sharer.php?u={$url}";
case 'twitter':
return "https://www.twitter.com/intent/tweet?url={$url}";
case 'linkedin':
$title = urlencode($c->getCollectionName());
return "https://www.linkedin.com/shareArticle?mini-true&url={$url}&title={$title}";
case 'pinterest':
return "https://www.pinterest.com/pin/create/button?url={$url}";
case 'google_plus':
return "https://plus.google.com/share?url={$url}";
case 'reddit':
return "https://www.reddit.com/submit?url={$url}";
case 'print':
return "javascript:window.print();";
case 'email':
$body = rawurlencode(t("Check out this article on %s:\n\n%s\n%s", Config::get('concrete.site'), $c->getCollectionName(), urldecode($url)));
$subject = rawurlencode(t('Thought you\'d enjoy this article.'));
return "mailto:?body={$body}&subject={$subject}";
}
}
}