本文整理汇总了PHP中Permissions::canAddSubpage方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canAddSubpage方法的具体用法?PHP Permissions::canAddSubpage怎么用?PHP Permissions::canAddSubpage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::canAddSubpage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
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();
$json['error'] = false;
示例2: foreach
foreach ($pages as $cobj) {
$cpobj = new Permissions($cobj);
if (!isset($striped) || $striped == 'ccm-list-record-alt') {
$striped = '';
} else {
if ($striped == '') {
$striped = 'ccm-list-record-alt';
}
}
$canEditPageProperties = $cpobj->canEditPageProperties();
$canEditPageSpeedSettings = $cpobj->canEditPageSpeedSettings();
$canEditPagePermissions = $cpobj->canEditPagePermissions();
$canEditPageDesign = $cpobj->canEditPageTheme() || $cpobj->canEditPageType();
$canViewPageVersions = $cpobj->canViewPageVersions();
$canDeletePage = $cpobj->canDeletePage();
$canAddSubpages = $cpobj->canAddSubpage();
$canAddExternalLinks = $cpobj->canAddExternalLink();
$permissionArray = array('canEditPageProperties' => $canEditPageProperties, 'canEditPageSpeedSettings' => $canEditPageSpeedSettings, 'canEditPagePermissions' => $canEditPagePermissions, 'canEditPageDesign' => $canEditPageDesign, 'canViewPageVersions' => $canViewPageVersions, 'canDeletePage' => $canDeletePage, 'canAddSubpages' => $canAddSubpages, 'canAddExternalLinks' => $canAddExternalLinks);
$canCompose = false;
$ct = CollectionType::getByID($cobj->getCollectionTypeID());
if (is_object($ct)) {
if ($ct->isCollectionTypeIncludedInComposer()) {
if ($canEditPageProperties && $h->canAccessComposer()) {
$canCompose = 1;
}
}
}
?>
<tr class="ccm-list-record <?php
echo $striped;
?>
示例3: getNode
function getNode($cItem, $level = 0, $autoOpenNodes = true)
{
if (!is_object($cItem)) {
$cID = $cItem;
$c = Page::getByID($cID, 'RECENT');
} else {
$cID = $cItem->getCollectionID();
$c = $cItem;
}
$cp = new Permissions($c);
$canEditPageProperties = $cp->canEditPageProperties();
$canEditPageSpeedSettings = $cp->canEditPageSpeedSettings();
$canEditPagePermissions = $cp->canEditPagePermissions();
$canEditPageDesign = $cp->canEditPageTheme() || $cp->canEditPageType();
$canViewPageVersions = $cp->canViewPageVersions();
$canDeletePage = $cp->canDeletePage();
$canAddSubpages = $cp->canAddSubpage();
$canAddExternalLinks = $cp->canAddExternalLink();
$nodeOpen = false;
if (is_array($_SESSION['dsbSitemapNodes'])) {
if (in_array($cID, $_SESSION['dsbSitemapNodes'])) {
$nodeOpen = true;
}
}
$status = '';
$cls = $c->getNumChildren() > 0 ? "folder" : "file";
$leaf = $c->getNumChildren() > 0 ? false : true;
$numSubpages = $c->getNumChildren() > 0 ? $c->getNumChildren() : '';
$cvName = $c->getCollectionName() ? $c->getCollectionName() : '(No Title)';
$cvName = $c->isSystemPage() ? t($cvName) : $cvName;
$selected = ConcreteDashboardSitemapHelper::isOneTimeActiveNode($cID) ? true : false;
$ct = CollectionType::getByID($c->getCollectionTypeID());
$isInTrash = $c->isInTrash();
$canCompose = false;
if (is_object($ct)) {
if ($ct->isCollectionTypeIncludedInComposer()) {
$h = Loader::helper('concrete/dashboard');
if ($cp->canEditPageProperties() && $h->canAccessComposer()) {
$canCompose = true;
}
}
}
$isTrash = $c->getCollectionPath() == TRASH_PAGE_PATH;
if ($isTrash || $isInTrash) {
$pk = PermissionKey::getByHandle('empty_trash');
if (!$pk->validate()) {
return false;
}
}
$cIcon = $c->getCollectionIcon();
$cAlias = $c->isAlias();
$cPointerID = $c->getCollectionPointerID();
if ($cAlias) {
if ($cPointerID > 0) {
$cIcon = ASSETS_URL_IMAGES . '/icons/alias.png';
$cAlias = 'POINTER';
$cID = $c->getCollectionPointerOriginalID();
} else {
$cIcon = ASSETS_URL_IMAGES . '/icons/alias_external.png';
$cAlias = 'LINK';
}
}
$node = array('cvName' => $cvName, 'cIcon' => $cIcon, 'cAlias' => $cAlias, 'isInTrash' => $isInTrash, 'isTrash' => $isTrash, 'numSubpages' => $numSubpages, 'status' => $status, 'canEditPageProperties' => $canEditPageProperties, 'canEditPageSpeedSettings' => $canEditPageSpeedSettings, 'canEditPagePermissions' => $canEditPagePermissions, 'canEditPageDesign' => $canEditPageDesign, 'canViewPageVersions' => $canViewPageVersions, 'canDeletePage' => $canDeletePage, 'canAddSubpages' => $canAddSubpages, 'canAddExternalLinks' => $canAddExternalLinks, 'canCompose' => $canCompose, 'id' => $cID, 'selected' => $selected);
if ($cID == 1 || $nodeOpen && $autoOpenNodes) {
// We open another level
$node['subnodes'] = $this->getSubNodes($cID, $level, false, $autoOpenNodes);
}
return $node;
}
示例4: t
}
</script>
<? } else {
$ctArray = CollectionType::getList();
$cp = new Permissions($c);
$cnt = 0;
for ($i = 0; $i < count($ctArray); $i++) {
$ct = $ctArray[$i];
if ($cp->canAddSubpage($ct)) {
$cnt++;
}
}
?>
<div id="ccm-choose-pg-type">
<h4 id="ccm-choose-pg-type-title"><?php
echo t('Choose a Page Type');
?>
</h4>
<ul id="ccm-select-page-type">
<?
foreach($ctArray as $ct) {
if ($cp->canAddSubpage($ct)) {
$requiredKeys=array();
示例5:
$canViewPane = $cp->canMoveOrCopyPage();
$divID = "ccm-collection-mcd";
break;
case 'delete':
$toolSection = "collection_delete";
$canViewPane = $cp->canDeletePage();
break;
case 'set_theme':
$toolSection = "collection_theme";
$divID = 'ccm-edit-collection-design';
$canViewPane = $cp->canEditPageTheme() || $cp->canEditPageType();
break;
case 'add':
$toolSection = "collection_add";
$divID = 'ccm-edit-collection-design';
$canViewPane = $cp->canAddSubpage();
if ($_REQUEST['ctID']) {
$ct = CollectionType::getByID($_REQUEST['ctID']);
if (!is_object($ct)) {
$canViewPane = false;
} else {
$canViewPane = $cp->canAddSubCollection($ct);
}
}
break;
case 'add_external':
$toolSection = "collection_add_external";
$divID = 'ccm-edit-collection-external';
$canViewPane = $cp->canAddExternalLink();
break;
case 'delete_external':
示例6: t
?>
?cID=<?php
echo $c->getCollectionID();
?>
&ctask=check-out<?php
echo $token;
?>
<? } else { ?>javascript:void(0);<? } ?>" class="btn primary <? if ($cantCheckOut) { ?> disabled <? } ?> launch-tooltip" <? if ($cantCheckOut) { ?>title="<?php
echo t('Someone has already checked this page out for editing.');
?>
"<? } ?>><?php
echo t('Edit this Page');
?>
</a>';
<? } ?>
<? if ($cp->canAddSubpage()) { ?>
menuHTML += '<a id="ccm-toolbar-add-subpage" dialog-width="645" dialog-modal="false" dialog-append-buttons="true" dialog-height="345" dialog-title="<?php
echo t('Add a Sub-Page');
?>
" href="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/edit_collection_popup.php?cID=<?php
echo $cID;
?>
&ctask=add"class="btn"><?php
echo t('Add a Sub-Page');
?>
</a>';
<? } ?>
menuHTML += '</div>';
示例7: validate
protected function validate()
{
$vt = Loader::helper('validation/strings');
$vn = Loader::Helper('validation/numbers');
$dt = Loader::helper("form/date_time");
if (!$vn->integer($this->post('cParentID'))) {
$this->error->add(t('You must choose a parent page for this blog entry.'));
}
if (!$vt->notempty($this->post('blogTitle'))) {
$this->error->add(t('Title is required'));
}
if (!$this->get('sections')) {
$this->error->add(t('You must have at least one page in your website designated as a "blog section".'));
}
Loader::model("attribute/categories/collection");
$akct = CollectionAttributeKey::getByHandle('blog_category');
$ctKey = $akct->getAttributeKeyID();
foreach ($this->post(akID) as $key => $value) {
if ($key == $ctKey) {
foreach ($value as $type => $values) {
if ($type == 'atSelectNewOption') {
foreach ($values as $cat => $valued) {
if ($valued == '') {
$this->error->add(t('Categories must have a value'));
}
}
}
}
}
}
if (!$this->error->has()) {
$parent = Page::getByID($this->post('cParentID'));
$cmp = new \Permissions($parent);
$parentPermissions = $cmp->canAddSubpage();
if (!$parentPermissions) {
$this->error->add(t('You do not have permission to add a page of that type to that area of the site.'));
}
}
}
示例8: validate
public function validate($error)
{
$vt = Loader::helper('validation/strings');
$vn = Loader::Helper('validation/numbers');
$dt = Loader::helper("form/date_time");
//$er = Loader::helper('validation/error');
if (!$vn->integer($_REQUEST['cParentID'])) {
$error->add(t('You must choose a parent page for this blog entry.'));
}
if (!$vt->notempty($_REQUEST['blogTitle'])) {
$error->add(t('Title is required'));
}
Loader::model("attribute/categories/collection");
$akct = CollectionAttributeKey::getByHandle('blog_category');
$ctKey = $akct->getAttributeKeyID();
foreach ($_REQUEST['akID'] as $key => $value) {
if ($key == $ctKey) {
foreach ($value as $type => $values) {
if ($type == 'atSelectNewOption') {
foreach ($values as $cat => $valued) {
if ($valued == '') {
$error->add(t('Categories must have a value'));
}
}
}
}
}
}
if (!$error->has()) {
$parent = Page::getByID($_REQUEST['cParentID']);
$cmp = new \Permissions($parent);
$parentPermissions = $cmp->canAddSubpage();
if (!$parentPermissions) {
$error->add(t('You do not have permission to add a page of that type to that area of the site.'));
}
}
return $error;
}