本文整理匯總了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.'));
}
}
示例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));
}
}
示例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;
}
示例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.'));
}
}
示例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();
}
示例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();
}
示例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.");
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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 . ' »';
$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);
}
示例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;
}
示例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();
}
}
}
示例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");
}
}