當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Page::getByID方法代碼示例

本文整理匯總了PHP中Page::getByID方法的典型用法代碼示例。如果您正苦於以下問題:PHP Page::getByID方法的具體用法?PHP Page::getByID怎麽用?PHP Page::getByID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Page的用法示例。


在下文中一共展示了Page::getByID方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: publish

 public function publish()
 {
     if ($this->validateAction()) {
         $r = $this->save();
         $ptr = $r[0];
         $pagetype = $r[1];
         $outputControls = $r[2];
         $c = $this->page;
         $e = $ptr->error;
         $validator = $pagetype->getPageTypeValidatorObject();
         if ($this->page->isPageDraft()) {
             $target = \Page::getByID($this->page->getPageDraftTargetParentPageID());
         } else {
             $target = \Page::getByID($this->page->getCollectionParentID());
         }
         $e->add($validator->validatePublishLocationRequest($target));
         $e->add($validator->validatePublishDraftRequest($c));
         $ptr->setError($e);
         if (!$e->has()) {
             $pagetype->publish($c);
             $ptr->setRedirectURL(Loader::helper('navigation')->getLinkToCollection($c));
         }
         $ptr->outputJSON();
     } else {
         throw new \Exception(t('Access Denied.'));
     }
 }
開發者ID:digideskio,項目名稱:concrete5,代碼行數:27,代碼來源:composer.php

示例2: getByID

 public function getByID($cID)
 {
     $c = \Page::getByID($cID);
     if ($c->getCollectionTypeHandle() == STACK_CATEGORY_PAGE_TYPE) {
         return $this->application->make('Concrete\\Core\\Page\\Stack\\Folder\\Folder', array($c));
     }
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:7,代碼來源:FolderService.php

示例3: cancel

 public function cancel(WorkflowProgress $wp)
 {
     $c = Page::getByID($this->getRequestedPageID());
     $wpr = new WorkflowProgressResponse();
     $wpr->setWorkflowProgressResponseURL(BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $c->getCollectionID());
     return $wpr;
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:7,代碼來源:page.php

示例4: publish

    public function publish() {
		if ($this->validateAction()) {
			$r = $this->save();
			$ptr = $r[0];
			$pagetype = $r[1];
			$outputControls = $r[2];

			$c = $this->page;
			$e = $ptr->error;
			if (!$c->getPageDraftTargetParentPageID()) {
				$e->add(t('You must choose a page to publish this page beneath.'));
			} else {
				$target = \Page::getByID($c->getPageDraftTargetParentPageID());
				$ppc = new \Permissions($target);
				$pagetype = $c->getPageTypeObject();
				if (!$ppc->canAddSubCollection($pagetype)) {
					$e->add(t('You do not have permission to publish a page in this location.'));
				}
			}
			$validator = $pagetype->getPageTypeValidatorObject();
			$e->add($validator->validatePublishDraftRequest($c));

			$ptr->setError($e);

			if (!$e->has()) {
				$pagetype->publish($c);
				$ptr->setRedirectURL(Loader::helper('navigation')->getLinkToCollection($c));
			}
			$ptr->outputJSON();
		} else {
			throw new \Exception(t('Access Denied.'));
		}
	}
開發者ID:robertdamoc,項目名稱:concrete5,代碼行數:33,代碼來源:composer.php

示例5: publish

 public function publish()
 {
     $r = $this->save();
     $ptr = $r[0];
     $pagetype = $r[1];
     $outputControls = $r[2];
     $c = $this->page;
     $e = Loader::helper('validation/error');
     if (!$c->getPageDraftTargetParentPageID()) {
         $e->add(t('You must choose a page to publish this page beneath.'));
     } else {
         $target = \Page::getByID($c->getPageDraftTargetParentPageID());
         $ppc = new \Permissions($target);
         if (!$ppc->canAddSubCollection($target)) {
             $e->add(t('You do not have permission to publish a page in this location.'));
         }
     }
     foreach ($outputControls as $oc) {
         if ($oc->isPageTypeComposerFormControlRequiredOnThisRequest()) {
             $r = $oc->validate();
             if ($r instanceof \Concrete\Core\Error\Error) {
                 $e->add($r);
             }
         }
     }
     $ptr->setError($e);
     if (!$e->has()) {
         $pagetype->publish($c);
         $ptr->setRedirectURL(Loader::helper('navigation')->getLinkToCollection($c));
     }
     $ptr->outputJSON();
 }
開發者ID:meixelsberger,項目名稱:concrete5-5.7.0,代碼行數:32,代碼來源:composer.php

示例6: testThemeGridAreaLayoutContainer

 public function testThemeGridAreaLayoutContainer()
 {
     $layout = \Concrete\Core\Area\Layout\ThemeGridLayout::add();
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(4);
     $column = $layout->addLayoutColumn();
     $column->setAreaLayoutColumnSpan(2);
     $column->setAreaLayoutColumnOffset(2);
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(6);
     $elemental = \Concrete\Core\Page\Theme\Theme::add('elemental');
     Page::addHomePage();
     Core::make('cache/request')->disable();
     $c = Page::getByID(1);
     $c->setTheme($elemental);
     $c = Page::getByID(1);
     $req = Request::getInstance();
     $req->setCurrentPage($c);
     $layout = \Concrete\Core\Area\Layout\Layout::getByID(1);
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\ThemeGridLayout', $layout);
     $columns = $layout->getAreaLayoutColumns();
     $this->assertEquals(3, count($columns));
     $formatter = $layout->getFormatter();
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\Formatter\\ThemeGridFormatter', $formatter);
     $this->assertEquals('<div class="row"></div>', (string) $formatter->getLayoutContainerHtmlObject());
     $req->clearCurrentPage();
 }
開發者ID:masteramuk,項目名稱:concrete5,代碼行數:25,代碼來源:AreaLayoutTest.php

示例7: run

 public function run()
 {
     $js = Loader::helper('json');
     $pl = new PageList();
     $pl->filterByCollectionTypeHandle('city');
     $pages = $pl->get();
     $updated = 0;
     $not = 0;
     echo "Loading city coordinates.. \n";
     foreach ($pages as $page) {
         if (!trim($page->getAttribute('latlng')) || trim($page->getAttribute('latlng')) === ',') {
             $parent = Page::getByID($page->getCollectionParentID());
             $city = "{$page->getCollectionName()}, {$parent->getCollectionName()}";
             $cityLocation = file_get_contents("https://maps.google.com/maps/api/geocode/json?address=" . urlencode($city) . "&sensor=false&key=AIzaSyAvsH_wiFHJCuMPPuVifJ7QgaRCStKTdZM");
             $responseObj = $js->decode($cityLocation);
             if ($responseObj->status != 'ZERO_RESULTS') {
                 $page->setAttribute('latlng', $responseObj->results[0]->geometry->location->lat . "," . $responseObj->results[0]->geometry->location->lng);
                 $updated++;
             } else {
                 $not++;
             }
         }
     }
     return t("{$updated} cities geocoded, {$not} cities failed lookup.");
 }
開發者ID:r-bansal,項目名稱:janeswalk-web-1,代碼行數:25,代碼來源:geocode_cities.php

示例8: view

 public function view($nodeID = 1, $auxMessage = false)
 {
     $dh = Loader::helper('concrete/dashboard/sitemap');
     if ($dh->canRead()) {
         $this->set('nodeID', $nodeID);
         $nodes = $dh->getSubNodes($nodeID, 1, false, false);
         $instanceID = time();
         $this->set('listHTML', $dh->outputRequestHTML($instanceID, 'explore', false, $nodes));
         $this->set('instanceID', $instanceID);
     }
     if (isset($_REQUEST['task']) && isset($_REQUEST['cNodeID'])) {
         $nc = Page::getByID($_REQUEST['cNodeID']);
         if ($_REQUEST['task'] == 'send_to_top') {
             $nc->movePageDisplayOrderToTop();
         } else {
             if ($_REQUEST['task'] == 'send_to_bottom') {
                 $nc->movePageDisplayOrderToBottom();
             }
         }
         $this->redirect('/dashboard/sitemap/explore', $nc->getCollectionParentID(), 'order_updated');
     }
     if ($auxMessage != false) {
         switch ($auxMessage) {
             case 'order_updated':
                 $this->set('message', t('Sort order saved'));
                 break;
         }
     }
     $this->set('dh', $dh);
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:30,代碼來源:explore.php

示例9: page

 public function page()
 {
     //create the model object
     $cal = new Page();
     //send the webclass
     $webClass = __CLASS__;
     //by pass the form
     $cmd = isset($_GET['cmd']) ? addslashes($_GET['cmd']) : 'read';
     if ($cmd == "edit") {
         //Crud::createForm($obj,$webClass);
         //die('edit');
         $id = isset($_GET['id']) ? addslashes($_GET['id']) : 0;
         if ($id) {
             $cal->getByID($id);
         }
         $mps['id'] = $id;
         $mps['obj'] = $cal;
         Mold::plugin("Page", "pageForm", $mps);
         exit;
     }
     $cid = addslashes($_GET['cid']);
     if ($cid != "") {
         $_SESSION['pageConID'] = $cid;
     } else {
         //unset($_SESSION['pageConID']);
     }
     $cal->read_filter_array = array("post_gallery_id" => $_SESSION['pageConID']);
     //echo $cid;
     //pr($cal);
     //run the crud utility
     Crud::run($cal, $webClass);
     //pr($mps);
 }
開發者ID:CapsuleCorpIndonesia,項目名稱:elang-combo,代碼行數:33,代碼來源:Page2ContainerWeb.php

示例10: getTranslatedPages

 public function getTranslatedPages($page = false, $sans = false)
 {
     $langms = new MultilingualSection();
     if ($page) {
         $ms = MultilingualSection::getByID($page->getCollectionID());
     } else {
         $page = Page::getCurrentPage();
         $ms = MultilingualSection::getCurrentSection();
     }
     if (is_object($ms)) {
         $lang = $ms->getLocale();
     }
     if ($sans) {
         $locales = self::getLocales($sans);
     } else {
         $locales = self::getLocales($lang);
     }
     $tpages = array();
     foreach ($locales as $locale) {
         $langms->msLocale = $locale;
         $id = $langms->getTranslatedPageID($page);
         $transPage = Page::getByID($id);
         $transPage->locale = $locale;
         if ($id > 0) {
             $tpages[$locale] = $transPage;
         }
     }
     return $tpages;
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:29,代碼來源:translated_pages.php

示例11: preview

 public function preview()
 {
     $request = \Request::getInstance();
     $c = \Page::getByID($this->request->get('cID'));
     $cp = new \Permissions($c);
     if ($cp->canViewPageVersions()) {
         $c->loadVersionObject(\Core::make('helper/security')->sanitizeInt($_REQUEST['cvID']));
         $spoofed_request = \Request::createFromGlobals();
         if ($device_handle = $request->headers->get('x-device-handle')) {
             if ($device = \Core::make('device/manager')->get($device_handle)) {
                 if ($agent = $device->getUserAgent()) {
                     $spoofed_request->headers->set('User-Agent', $agent);
                 }
             }
         }
         $spoofed_request->setCustomRequestUser(-1);
         $spoofed_request->setCurrentPage($c);
         \Request::setInstance($spoofed_request);
         $controller = $c->getPageController();
         $controller->runTask('view', array());
         $view = $controller->getViewObject();
         $response = new \Response();
         $content = $view->render();
         // Reset just in case.
         \Request::setInstance($request);
         $response->setContent($content);
         $response->send();
         exit;
     }
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:30,代碼來源:devices.php

示例12: 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 . ' &raquo;';
         $previousLinkText = '&laquo; ' . $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);
 }
開發者ID:homer6,項目名稱:concrete5-mirror,代碼行數:25,代碼來源:controller.php

示例13: 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;
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:29,代碼來源:controller.php

示例14: 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();
         }
     }
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:28,代碼來源:block.php

示例15: save

 public function save()
 {
     $this->verify($this->post('ctID'));
     if ($this->post('ctIncludeInComposer')) {
         switch ($this->post('ctComposerPublishPageMethod')) {
             case 'PARENT':
                 $page = Page::getByID($this->post('ctComposerPublishPageParentID'));
                 if ($page->isError()) {
                     $this->error->add(t('Parent page not selected'));
                 } else {
                     $this->ct->saveComposerPublishTargetPage($page);
                 }
                 break;
             case 'PAGE_TYPE':
                 $ct = CollectionType::getByID($this->post('ctComposerPublishPageTypeID'));
                 $this->ct->saveComposerPublishTargetPageType($ct);
                 break;
             default:
                 $this->ct->saveComposerPublishTargetAll();
                 break;
         }
         if (!$this->error->has()) {
             $this->ct->saveComposerAttributeKeys($this->post('composerAKID'));
             $this->redirect('/dashboard/pages/types/composer', 'view', $this->ct->getCollectionTypeID(), 'updated');
         } else {
             $this->view($this->ct->getCollectionTypeID());
         }
     } else {
         $this->ct->resetComposerData();
         $this->redirect("/dashboard/pages/types", "clear_composer");
     }
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:32,代碼來源:composer.php


注:本文中的Page::getByID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。