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


PHP PageType类代码示例

本文整理汇总了PHP中PageType的典型用法代码示例。如果您正苦于以下问题:PHP PageType类的具体用法?PHP PageType怎么用?PHP PageType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createPage

 protected static function createPage($name, $parent = false, $type = false, $template = false)
 {
     if ($parent === false) {
         $parent = Page::getByID(HOME_CID);
     } else {
         if (is_string($parent)) {
             $parent = Page::getByPath($parent);
         }
     }
     if ($type === false) {
         $type = 1;
     }
     if (is_string($type)) {
         $pt = PageType::getByHandle($type);
     } else {
         $pt = PageType::getByID($type);
     }
     if ($template === false) {
         $template = 1;
     }
     if (is_string($template)) {
         $template = PageTemplate::getByHandle($template);
     } else {
         $template = PageTemplate::getByID($template);
     }
     $page = $parent->add($pt, array('cName' => $name, 'pTemplateID' => $template->getPageTemplateID()));
     return $page;
 }
开发者ID:masteramuk,项目名称:concrete5,代码行数:28,代码来源:PageTestCase.php

示例2: action_post

	public function action_post() {
		// happens through ajax
		$pagetype = PageType::getByID($this->ptID);
		if (is_object($pagetype) && $this->enableNewTopics) {
			$ccp = new Permissions($pagetype);
			if ($ccp->canAddPageType()) {
				$pagetypes = $pagetype->getPageTypeComposerPageTypeObjects();
				$ctTopic = $pagetypes[0];
				$c = Page::getCurrentPage();
				$e = $pagetype->validatePublishRequest($ctTopic, $c);
				$r = new PageTypePublishResponse($e);
				if (!$e->has()) {
					$d = $pagetype->createDraft($ctTopic);
					$d->setPageDraftTargetParentPageID($c->getCollectionID());
					$d->saveForm();
					$d->publish();
					$nc = Page::getByID($d->getCollectionID(), 'RECENT');
					$link = Loader::helper('navigation')->getLinkToCollection($nc, true);
					$r->setRedirectURL($link);
				}
				$r->outputJSON();
			}
		}
		exit;
	}
开发者ID:robertdamoc,项目名称:concrete5,代码行数:25,代码来源:controller.php

示例3: addPage2

 protected function addPage2()
 {
     $home = Page::getByID(HOME_CID);
     PageType::add(array('handle' => 'alternate', 'name' => 'Alternate'));
     $pt = PageType::getByID(2);
     $template = PageTemplate::getByID(1);
     $page = $home->add($pt, array('uID' => 1, 'cName' => 'Test page', 'pTemplateID' => $template->getPageTemplateID()));
     return $page;
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:9,代码来源:PageControllerTest.php

示例4: renderSearchField

 public function renderSearchField()
 {
     $form = \Core::make('helper/form');
     $html = $form->select('ptID', array_reduce(\PageType::getList(), function ($types, $type) {
         $types[$type->getPageTypeID()] = $type->getPageTypeDisplayName();
         return $types;
     }), $this->data['ptID']);
     return $html;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:9,代码来源:PageTypeField.php

示例5: view

 public function view()
 {
     $this->ptID = intval($this->request->query->get('ptID'));
     $this->cParentID = intval($this->request->query->get('cParentID'));
     $this->lastestversion = isset($_GET['lastestversion']) ? true : false;
     $list = new PageList();
     $list->sortByDisplayOrder();
     if ($this->ptID > 0) {
         $list->filterByPageTypeID(intval($this->ptID));
     }
     if ($this->cParentID != 0) {
         $list->filterByPath(Page::getByID($this->cParentID)->getCollectionPath());
     }
     $page_result = $list->getResults();
     $cv_list = array();
     $nh = Core::make('helper/navigation');
     foreach ($page_result as $res) {
         $cp = new Permissions($res);
         if ($cp->canViewPageVersions()) {
             $cv = new VersionList($res);
             if (is_object($cv)) {
                 if ($this->lastestversion == true) {
                     $cvcheck = $cv->getPage(-1);
                     if ($cvcheck[0]->cvIsApproved != 1) {
                         $cv_list[$res->getCollectionID()]['vObj'] = $cv->getPage(-1);
                         $cv_list[$res->getCollectionID()]['cName'] = $res->getCollectionName();
                         $cv_list[$res->getCollectionID()]['cID'] = $res->getCollectionID();
                         $cv_list[$res->getCollectionID()]['link'] = $nh->getLinkToCollection($res);
                     }
                 } else {
                     $cv_list[$res->getCollectionID()]['vObj'] = $cv->getPage(-1);
                     $cv_list[$res->getCollectionID()]['cName'] = $res->getCollectionName();
                     $cv_list[$res->getCollectionID()]['cID'] = $res->getCollectionID();
                     $cv_list[$res->getCollectionID()]['link'] = $nh->getLinkToCollection($res);
                 }
             }
         }
     }
     $cvl = new ItemList();
     $cvl->setItems($cv_list);
     $cvl->setItemsPerPage(10);
     $showPagination = false;
     if ($cvl->getSummary()->pages > 1) {
         $showPagination = true;
         $paginator = $cvl->getPagination();
     }
     $this->set('cParentID', $this->cParentID);
     $this->set('paginator', $paginator);
     $this->set('showPagination', $showPagination);
     $this->set('lastestversion', $this->lastestversion);
     $this->set('cvlresult', $cvl->getPage());
     $this->set('ptID', $this->ptID);
     $pagetypes = \PageType::getList();
     $this->set('pts', $pagetypes);
 }
开发者ID:acliss19xx,项目名称:concrete5_collection_version_list,代码行数:55,代码来源:search.php

示例6: create_new

 public function create_new()
 {
     $pr = new PageEditResponse();
     $ms = Section::getByID($this->request->request->get('section'));
     // we get the related parent id
     if ($this->page->isPageDraft()) {
         $cParentID = $this->page->getPageDraftTargetParentPageID();
     } else {
         $cParentID = $this->page->getCollectionParentID();
     }
     $cParent = \Page::getByID($cParentID);
     $cParentRelatedID = $ms->getTranslatedPageID($cParent);
     if ($cParentRelatedID > 0) {
         // we copy the page underneath it and store it
         $ct = \PageType::getByID($this->page->getPageTypeID());
         if ($this->page->isPageDraft()) {
             $ptp = new \Permissions($ct);
             if (!$ptp->canAddPageType()) {
                 throw new \Exception(t('You do not have permission to add a page of this type.'));
             }
         }
         $newParent = \Page::getByID($cParentRelatedID);
         $cp = new \Permissions($newParent);
         if ($cp->canAddSubCollection($ct)) {
             if ($this->page->isPageDraft()) {
                 $targetParent = \Page::getByPath(\Config::get('concrete.paths.drafts'));
             } else {
                 $targetParent = $newParent;
             }
             $newPage = $this->page->duplicate($targetParent);
             if (is_object($newPage)) {
                 if ($this->page->isPageDraft()) {
                     $newPage->setPageDraftTargetParentPageID($newParent->getCollectionID());
                     Section::relatePage($this->page, $newPage, $ms->getLocale());
                     $pr->setMessage(t('New draft created.'));
                 } else {
                     // grab the approved version and unapprove it
                     $v = Version::get($newPage, 'ACTIVE');
                     if (is_object($v)) {
                         $v->deny();
                     }
                     $pr->setMessage(t('Unapproved page created. You must publish this page before it is live.'));
                 }
                 $ih = Core::make('multilingual/interface/flag');
                 $icon = (string) $ih->getSectionFlagIcon($ms);
                 $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName());
                 $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink());
                 $pr->setAdditionalDataAttribute('icon', $icon);
             }
         } else {
             throw new \Exception(t('You do not have permission to add this page to this section of the tree.'));
         }
     }
     $pr->outputJSON();
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:55,代码来源:multilingual.php

示例7: TransformedText

 /** Constructor.
  *
  * @param WikiDB_Page $page
  * @param string $text  The packed page revision content.
  * @param hash $meta    The version meta-data.
  * @param string $type_override  For markup of page using a different
  *        pagetype than that specified in its version meta-data.
  */
 function TransformedText($page, $text, $meta, $type_override = false)
 {
     $pagetype = false;
     if ($type_override) {
         $pagetype = $type_override;
     } elseif (isset($meta['pagetype'])) {
         $pagetype = $meta['pagetype'];
     }
     $this->_type = PageType::GetPageType($pagetype);
     $this->CacheableMarkup($this->_type->transform($page, $text, $meta), $page->getName());
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:19,代码来源:PageType.php

示例8: create_new

 public function create_new()
 {
     $pr = new PageEditResponse();
     $ms = Section::getByID($this->request->request->get('section'));
     // we get the related parent id
     $cParentID = $this->page->getCollectionParentID();
     $cParent = \Page::getByID($cParentID);
     $cParentRelatedID = $ms->getTranslatedPageID($cParent);
     if ($cParentRelatedID > 0) {
         // we copy the page underneath it and store it
         $newParent = \Page::getByID($cParentRelatedID);
         $ct = \PageType::getByID($this->page->getPageTypeID());
         $cp = new \Permissions($newParent);
         if ($cp->canAddSubCollection($ct) && $this->page->canMoveCopyTo($newParent)) {
             $newPage = $this->page->duplicate($newParent);
             if (is_object($newPage)) {
                 // grab the approved version and unapprove it
                 $v = Version::get($newPage, 'ACTIVE');
                 if (is_object($v)) {
                     $v->deny();
                     $pkr = new ApprovePageRequest();
                     $pkr->setRequestedPage($newPage);
                     $u = new \User();
                     $pkr->setRequestedVersionID($v->getVersionID());
                     $pkr->setRequesterUserID($u->getUserID());
                     $response = $pkr->trigger();
                     if (!$response instanceof Response) {
                         // we are deferred
                         $pr->setMessage(t('<strong>Request Saved.</strong> You must complete the workflow before this change is active.'));
                     } else {
                         $ih = Core::make('multilingual/interface/flag');
                         $icon = $ih->getSectionFlagIcon($ms);
                         $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName());
                         $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink());
                         $pr->setAdditionalDataAttribute('icon', $icon);
                         $pr->setMessage(t('Page created.'));
                     }
                 }
             }
         } else {
             throw new \Exception(t('You do not have permission to add this page to this section of the tree.'));
         }
     }
     $pr->outputJSON();
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:45,代码来源:multilingual.php

示例9: setUp

 public function setUp()
 {
     $this->tables = array_merge($this->tables, array('PermissionAccessList', 'PageTypeComposerFormLayoutSets', 'AttributeSetKeys', 'AttributeSets', 'AttributeKeyCategories', 'PermissionAccessEntityTypes', 'Packages', 'AttributeKeys', 'AttributeTypes', 'PageFeeds'));
     parent::setUp();
     \Concrete\Core\Permission\Access\Entity\Type::add('page_owner', 'Page Owner');
     \Concrete\Core\Permission\Category::add('page');
     \Concrete\Core\Permission\Key\Key::add('page', 'view_page', 'View Page', '', 0, 0);
     PageTemplate::add('left_sidebar', 'Left Sidebar');
     PageTemplate::add('right_sidebar', 'Right Sidebar');
     PageType::add(array('handle' => 'alternate', 'name' => 'Alternate'));
     PageType::add(array('handle' => 'another', 'name' => 'Another'));
     foreach ($this->pageData as $data) {
         $c = call_user_func_array(array($this, 'createPage'), $data);
         $c->reindex();
     }
     $this->list = new \Concrete\Core\Page\PageList();
     $this->list->ignorePermissions();
 }
开发者ID:masteramuk,项目名称:concrete5,代码行数:18,代码来源:PageListTest.php

示例10: get

 /**
  * @method POST
  */
 function get()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $pageTypeId = -1;
         parse_str($this->request->data, $request);
         // parse request
         if (isset($request['pageTypeId'])) {
             $pageTypeId = $request['pageTypeId'];
         }
         if (isset($request['friendlyId'])) {
             $friendlyId = $request['friendlyId'];
             $pageType = PageType::GetByFriendlyId($friendlyId, $authUser->SiteId);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         if (isset($request['pageTypeUniqId'])) {
             $pageType = PageType::GetByPageTypeUniqId($request['pageTypeUniqId']);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         // check that pageTypeId was set
         if ($pageTypeId != -1) {
             $list = Category::GetCategories($pageTypeId);
             // return a json response
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = json_encode($list);
             return $response;
         } else {
             // return an empty response (e.g. root has not categories)
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = '[]';
             return $response;
         }
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:45,代码来源:category.php

示例11: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $page_type_list = array();
     $type = PageType::model()->findAll('status=1');
     foreach ($type as $page_type) {
         $page_type_list[$page_type->page_type_id] = $page_type->name_th;
     }
     $page_id_list = array();
     $page = Page::model()->findAll('status=1');
     foreach ($page as $page_list) {
         $page_id_list[$page_list->page_id] = $page_list->name_th;
     }
     if (isset($_POST['LeftMenu'])) {
         $_POST['LeftMenu']['user_id'] = Yii::app()->user->id;
         $model->attributes = $_POST['LeftMenu'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model, 'page_type_list' => $page_type_list, 'page_id_list' => $page_id_list));
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:29,代码来源:LeftMenuController.php

示例12: explode

$canMoveCopyPages = true;
if (isset($_REQUEST['origCID']) && strpos($_REQUEST['origCID'], ',') > -1) {
    $ocs = explode(',', $_REQUEST['origCID']);
    foreach ($ocs as $ocID) {
        $originalPages[] = Page::getByID($ocID);
    }
}
foreach ($originalPages as $oc) {
    $ocp = new Permissions($oc);
    if (!$ocp->canRead()) {
        $canReadSource = false;
    }
    if (!$ocp->canMoveOrCopyPage()) {
        $canMoveCopyPages = false;
    }
    $ct = PageType::getByID($oc->getPageTypeID());
    if (!$dcp->canAddSubpage($ct)) {
        $canAddSubContent = false;
    }
    if (!$oc->canMoveCopyTo($dc)) {
        $canMoveCopyTo = false;
    }
    if (!$u->isSuperUser() || $oc->getCollectionPointerID() > 0) {
        $canCopyChildren = false;
    }
}
if (is_object($dc) && !$dc->isError() && $dc->isAlias()) {
    $canMoveCopyTo = false;
}
$valt = Loader::helper('validation/token');
$json = array();
开发者ID:ceko,项目名称:concrete5-1,代码行数:31,代码来源:sitemap_drag_request.php

示例13: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$pagetypes = PageType::getList();
$types = array();
foreach ($pagetypes as $pt) {
    $types[$pt->getPageTypeID()] = $pt->getPageTypeName();
}
?>

<input type="hidden" name="tab[]" value="posting" />

<div class="form-horizontal">
	<div class="control-group">
		<label class="control-label"><?php 
echo t('Enable New Topics');
?>
</label>
		<div class="controls">
			<div class="radio">
                <label>
				<?php 
echo $form->radio('enablePostingFromGathering', 0, $enablePostingFromGathering);
?>
				<span><?php 
echo t('No, posting is disabled.');
?>
</span>
                </label>
			</div>
			<div class="radio">
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:31,代码来源:posting.php

示例14: getField

 protected function getField($field)
 {
     $r = new stdClass();
     $r->field = $field;
     $searchRequest = $this->searchRequest->getSearchRequest();
     $form = Loader::helper('form');
     $wdt = Loader::helper('form/date_time');
     /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */
     $html = '';
     switch ($field) {
         case 'keywords':
             $html .= $form->text('keywords', $searchRequest['keywords']);
             break;
         case 'date_public':
             $html .= $wdt->datetime('date_public_from', $wdt->translate('date_public_from', $searchRequest)) . t('to') . $wdt->datetime('date_public_to', $wdt->translate('date_public_to', $searchRequest));
             break;
         case 'date_added':
             $html .= $wdt->datetime('date_added_from', $wdt->translate('date_added_from', $searchRequest)) . t('to') . $wdt->datetime('date_added_to', $wdt->translate('date_added_to', $searchRequest));
             break;
         case 'last_modified':
             $html .= $wdt->datetime('last_modified_from', $wdt->translate('last_modified_from', $searchRequest)) . t('to') . $wdt->datetime('last_modified_to', $wdt->translate('last_modified_to', $searchRequest));
             break;
         case 'owner':
             $html .= $form->text('owner');
             break;
         case 'permissions_inheritance':
             $html .= '<select name="cInheritPermissionsFrom" class="form-control">';
             $html .= '<option value="PARENT"' . ($searchRequest['cInheritPermissionsFrom'] == 'PARENT' ? ' selected' : '') . '>' . t('Parent Page') . '</option>';
             $html .= '<option value="TEMPLATE"' . ($searchRequest['cInheritPermissionsFrom'] == 'TEMPLATE' ? ' selected' : '') . '>' . t('Page Type') . '</option>';
             $html .= '<option value="OVERRIDE"' . ($searchRequest['cInheritPermissionsFrom'] == 'OVERRIDE' ? ' selected' : '') . '>' . t('Itself (Override)') . '</option>';
             $html .= '</select>';
             break;
         case 'type':
             $html .= $form->select('ptID', array_reduce(\PageType::getList(), function ($types, $type) {
                 $types[$type->getPageTypeID()] = $type->getPageTypeDisplayName();
                 return $types;
             }), $searchRequest['ptID']);
             break;
         case 'version_status':
             $versionToRetrieve = \Concrete\Core\Page\PageList::PAGE_VERSION_RECENT;
             if ($searchRequest['versionToRetrieve']) {
                 $versionToRetrieve = $searchRequest['versionToRetrieve'];
             }
             $html .= '<div class="radio"><label>' . $form->radio('versionToRetrieve', \Concrete\Core\Page\PageList::PAGE_VERSION_RECENT, $versionToRetrieve) . t('All') . '</label></div>';
             $html .= '<div class="radio"><label>' . $form->radio('versionToRetrieve', \Concrete\Core\Page\PageList::PAGE_VERSION_ACTIVE, $versionToRetrieve) . t('Approved') . '</label></div>';
             break;
         case 'parent':
             $ps = Loader::helper("form/page_selector");
             $html .= $ps->selectPage('cParentIDSearchField');
             $html .= '<div class="form-group">';
             $html .= '<label class="control-label">' . t('Search All Children?') . '</label>';
             $html .= '<div class="radio"><label>' . $form->radio('cParentAll', 0, false) . ' ' . t('No') . '</label></div>';
             $html .= '<div class="radio"><label>' . $form->radio('cParentAll', 1, false) . ' ' . t('Yes') . '</label></div>';
             $html .= '</div>';
             break;
         case 'num_children':
             $html .= '<div class="form-inline"><select name="cChildrenSelect" class="form-control">';
             $html .= '<option value="gt"' . ($searchRequest['cChildrenSelect'] == 'gt' ? ' selected' : '') . '>' . t('More Than') . '</option>';
             $html .= '<option value="eq"' . ($searchRequest['cChildrenSelect'] == 'eq' ? ' selected' : '') . '>' . t('Equal To') . '</option>';
             $html .= '<option value="lt"' . ($searchRequest['cChildrenSelect'] == 'lt' ? ' selected' : '') . '>' . t('Fewer Than') . '</option>';
             $html .= '</select>';
             $html .= ' <input type="text" name="cChildren" class="form-control" value="' . $searchRequest['cChildren'] . '" /></div>';
             break;
         case 'theme':
             $html .= '<select name="pThemeID" class="form-control">';
             $themes = PageTheme::getList();
             foreach ($themes as $pt) {
                 $html .= '<option value="' . $pt->getThemeID() . '" ' . ($pt->getThemeID() == $searchRequest['pThemeID'] ? ' selected' : '') . '>' . $pt->getThemeName() . '</option>';
             }
             $html .= '</select>';
             break;
         default:
             if (Loader::helper('validation/numbers')->integer($field)) {
                 $ak = CollectionAttributeKey::getByID($field);
                 $html .= $ak->render('search', null, true);
             }
             break;
     }
     $r->html = $html;
     $ag = ResponseAssetGroup::get();
     $r->assets = array();
     foreach ($ag->getAssetsToOutput() as $position => $assets) {
         foreach ($assets as $asset) {
             if (is_object($asset)) {
                 // have to do a check here because we might be included a dumb javascript call like i18n_js
                 $r->assets[$asset->getAssetType()][] = $asset->getAssetURL();
             }
         }
     }
     return $r;
 }
开发者ID:robertdamoc,项目名称:concrete5,代码行数:91,代码来源:pages.php

示例15: get

 /**
  * @method POST
  */
 function get()
 {
     parse_str($this->request->data, $request);
     // parse request
     $siteUniqId = SITE_UNIQ_ID;
     $pageTypeUniqId = $request['pageTypeUniqId'];
     $site = Site::GetBySiteUniqId($siteUniqId);
     $pageType = PageType::GetByPageTypeUniqId($pageTypeUniqId);
     // Get all pages
     $total = Page::GetPagesCount($site['SiteId'], $pageType['PageTypeId'], true);
     $json = '{"total":"' . $total . '"}';
     header('Content-type: application/json');
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'applicaton/json';
     $response->body = $json;
     return $response;
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:21,代码来源:page.php


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